#19 For Loop in Java

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 34

  • @munib2023
    @munib2023 Год назад +43

    Please sir make Data Structure and Algorithm Course in Java.

  • @mrchaitu7
    @mrchaitu7 4 месяца назад +5

    11:30
    first it will pick i value
    second it will check the condition 1

  • @junaidshowkat949
    @junaidshowkat949 Год назад +14

    🎯 Key Takeaways for quick navigation:
    00:13 For loops provide a concise way to initialize, conditionally iterate, and update a counter variable in one line.
    01:55 The for loop syntax allows you to combine initialization, condition, and increment/decrement statements in one line, separated by semicolons.
    02:22 Make sure to set the initial value correctly, as the loop will not run if the initial value doesn't meet the condition.
    03:15 You can start the loop at zero, but be mindful of the ending condition to ensure the desired number of iterations.
    04:51 Common practice is to use "less than" condition for loops that start from zero and end before a specific value.
    06:42 Nested loops can be used to create patterns or print structured data, like days and hours in a calendar.
    08:47 When concatenating numbers and strings, use parentheses to ensure proper mathematical operations.
    10:10 Be cautious when setting loop conditions involving numbers and time intervals, ensuring accurate ranges.
    11:19 For loops execute the initialization, condition check, and increment/decrement sequentially for each iteration.
    12:56 It's possible to skip parts of the for loop structure and perform necessary operations outside the loop if needed.
    Made with HARPA AI

    • @AnuragRawat01
      @AnuragRawat01 Год назад

      Excellent💯😃
      But what do you mean by barpa Al
      ??

    • @aditya_raj09
      @aditya_raj09 7 месяцев назад

      @@AnuragRawat01 this timestamp given by harpa_ai

    • @narrativegatherer3128
      @narrativegatherer3128 3 месяца назад

      ​The summary was made using Harpa AI online service ​@@AnuragRawat01

  • @BetterSachet
    @BetterSachet Год назад +6

    real-time examples are very confusing sometimes it all messes up , better if you have some prepared examples but really I enjoy your lectures sir and learn something extra !

  • @IMMWICKED
    @IMMWICKED Год назад +2

    So, I was following your code at the end to make my own kind of Daily Schedule.
    public static void main(String a[ ]) {
    System.out.println("My weekly school schedule on Java!");
    for (int i = 1; i

  • @aishikmondal350
    @aishikmondal350 Год назад +3

    Sir you are excellent. 😊

  • @trickrunner4842
    @trickrunner4842 6 месяцев назад +1

    couldnt you also just make j=9 and j

  • @ivanzq21
    @ivanzq21 11 месяцев назад +1

    I like the high quality video its great

  • @DipakShende-oe9pn
    @DipakShende-oe9pn 9 месяцев назад +1

    🎯 Key Takeaways for quick navigation:
    00:00 🔄 *For Loop Introduction*
    - Introduction to the for Loop in Java.
    - Comparison with while loop structure.
    - Overview of initialization, condition, and increment statements in for Loop.
    01:13 🔄 *For Loop Syntax*
    - Explanation of combining initialization, condition, and increment statements in a single line.
    - Differentiating for Loop from while loop regarding this syntax.
    - Practical demonstration of a simple for Loop example.
    02:35 🔄 *Working of For Loop*
    - Understanding the execution flow of for Loop.
    - Demonstrating the role of initial value, condition check, and increment in a for Loop.
    - Practical example of printing values in both increment and decrement order.
    04:51 🔄 *Common For Loop Syntax*
    - Introduction to a common syntax for for Loop with initialization, condition, and increment statements.
    - Clarification on using "less than" for ending at a specified value.
    - Practical example of printing values starting from zero and ending before four.
    05:59 🔄 *For Loop for Building a Calendar*
    - Demonstrating a practical example of using for Loop to build a weekly calendar.
    - Nested for Loop usage for printing hours in a day.
    - Addressing challenges and debugging issues during the example.
    11:19 🔄 *Execution Sequence in For Loop*
    - Explanation of the execution sequence in a for Loop.
    - Debugging demonstration to showcase the order of execution.
    - Flexibility to skip the initialization or increment statement in the for Loop structure.
    Made with HARPA AI

  • @ShradhaGuntuk
    @ShradhaGuntuk 4 месяца назад

    Sir after completing ur whole course did u provide any certificate for completion of course

  • @shreyasshahu1423
    @shreyasshahu1423 3 месяца назад

    Calendar with AM and PM supported :
    class Hello {
    public static void main(String args[]) {
    for (int i = 1; i 12 ? j - 12 : j) + (j >= 12 ? " PM" : " AM") + " - "
    + (endTime >= 12 ? (endTime == 12 ? endTime : endTime - 12) + " PM" : endTime + " AM"));
    }
    }
    }
    }

  • @akulasaitejaswani7662
    @akulasaitejaswani7662 Год назад +1

    Instead of adding the j with 8, we can initialize j=9;j

  • @shruthij5838
    @shruthij5838 Год назад

    sir please do a playlist of dsa with python

  • @Jorgerodriguez-cf5vy
    @Jorgerodriguez-cf5vy 11 месяцев назад

    You are awesome!!!

  • @ajitkumarsaha4074
    @ajitkumarsaha4074 Год назад +1

    What if at 2:56 we do
    for( i=5; i

    • @aryansemwal2472
      @aryansemwal2472 Год назад

      it will run forever until it exceeds your memory

    • @anisha7909
      @anisha7909 Год назад +1

      You won't be getting any results

  • @DenyTheZeitgeist
    @DenyTheZeitgeist Месяц назад

    Awesome, now I'm even more lost.

  • @BugHunterMdSam
    @BugHunterMdSam 5 месяцев назад

    thank you

  • @SRV025
    @SRV025 Год назад

    What is the need for while loop if for loop uses less space?

    • @durgaraoponnuru17
      @durgaraoponnuru17 Год назад +1

      I hope, if we know the limit we use for loop. If we don't know the limit (numerical value) we use while loop.

    • @chaithanyajog4554
      @chaithanyajog4554 Год назад

      ​@@durgaraoponnuru17if we know the no of iteration then have to use for right?

    • @durgaraoponnuru17
      @durgaraoponnuru17 Год назад

      @@chaithanyajog4554 Not Sure.. But I guess.

  • @ghettoslick2000
    @ghettoslick2000 Год назад

    Thanks

  • @Roman-oo4tz
    @Roman-oo4tz Год назад

    Thank you 😊

  • @StarK24769
    @StarK24769 5 месяцев назад

    Just came up with without railway time 👍👍
    for(int i=1;i

  • @commonmansupport9766
    @commonmansupport9766 7 месяцев назад

    May be you know the syntax & programming logics but your explanation is wrong

    • @narrativegatherer3128
      @narrativegatherer3128 3 месяца назад

      क्यों नाराज़ हो रहे, भाई?

  • @md.ikramulislam9708
    @md.ikramulislam9708 2 месяца назад

    for(int j=1;j12?(String.format("%02d",(j-12))):
    //String.format("%2d", variable)
    //append 0 before single digit
    (String.format("%02d",j)))+
    ":00" + (j>=12? "pm" : "am")+ "-" +
    //determine am and pm
    (l>12&&l!=24?(String.format("%02d",(l-12))):
    //append 0 before single digit
    l>12&&l==24?(String.format("%02d",(l=0))):
    //12 am becomes 00 am
    (String.format("%02d",l)))+
    ":00"+ (l>11 && l!=24 ? "pm" : "am"));
    //12 am excluded
    }