#19 For Loop in Java

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ม.ค. 2023
  • Check out our courses:
    Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
    Coupon: TELUSKO10 (10% Discount)
    Master Java Spring Development : bit.ly/java-spring-cloud
    Udemy Courses:
    Java:- bit.ly/JavaUdemyTelusko
    Spring:- bit.ly/SpringUdemyTelusko
    Java For Programmers:- bit.ly/javaProgrammers
    For More Queries WhatsApp or Call on : +919008963671
    website : courses.telusko.com/
    In this lecture we will learn:
    - Overview of a while loop
    - For loop and its point
    - Syntax of for loop
    - Nested for loops
    #1
    -In the while loop we have three things: Initialization, Condition, and then increment.
    -We do these three things in different lines in a while loop.
    -Sometimes we do not know about the ending point, where this loop will get end. As it may end based on some conditions.
    #2
    - In the finite loop, we know about its starting and ending.
    - For loop supports three different statements in one line.
    - We can put initialization, condition and increment in one single line in for loop.
    - It is mostly used when the number of iterations is fixed.
    - Because of the binary format computer starts from 0.
    - So, in general, we start from 0 and end at count-1 ie., one less than the total number of iterations.
    - Loops are very useful when we have to print some pattern or want to print things repeatedly.
    #3
    Syntax of For Loop:-
    for(initiation; condition; incrementation or decrementation)
    {
    statements;
    }
    * init - The init expression is used for initializing a variable, and it is executed only once.
    * condition - It executes the condition statement for every iteration. If it evaluates the condition to be true, it executes the body of the loop. The loop will continue to run until the condition becomes false.
    * incr/ decr - It is the increment or decrement statement applied to the variable to update the initial expression.
    - First initiation and condition statement execute and then execution of statements takes place and then increment takes place at last.
    - We can also skip any of the three parts as per the need.
    #4
    Nested For loops:-
    - We can also use nested for loops as same as while loop. Nested loops mean loop inside a loop.
    - Whenever the outer loop meets the condition, the inner loop is executed completely.
    Github repo : github.com/navinreddy20/Javac...
    Java:- bit.ly/JavaUdemyTelusko
    Spring:- bit.ly/SpringUdemyTelusko
    More Learning :
    Java :- bit.ly/3x6rr0N
    Python :- bit.ly/3GRc7JX
    Django :- bit.ly/3MmoJK6
    JavaScript :- bit.ly/3tiAlHo
    Node JS :- bit.ly/3GT4liq
    Rest Api :-bit.ly/3MjhZwt
    Servlet :- bit.ly/3Q7eA7k
    Spring Framework :- bit.ly/3xi7buh
    Design Patterns in Java :- bit.ly/3MocXiq
    Docker :- bit.ly/3xjWzLA
    Blockchain Tutorial :- bit.ly/3NSbOkc
    Corda Tutorial:- bit.ly/3thbUKa
    Hyperledger Fabric :- bit.ly/38RZCRB
    NoSQL Tutorial :- bit.ly/3aJpRuc
    Mysql Tutorial :- bit.ly/3thpr4L
    Data Structures using Java :- bit.ly/3MuJa7S
    Git Tutorial :- bit.ly/3NXyCPu
    Donation:
    PayPal Id : navinreddy20
    www.telusko.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 29

  • @munib2023
    @munib2023 ปีที่แล้ว +28

    Please sir make Data Structure and Algorithm Course in Java.

  • @mrchaitu7
    @mrchaitu7 หลายเดือนก่อน +4

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

  • @junaidshowkat949
    @junaidshowkat949 ปีที่แล้ว +11

    🎯 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 11 หลายเดือนก่อน

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

    • @aditya_raj09
      @aditya_raj09 3 หลายเดือนก่อน

      @@AnuragRawat01 this timestamp given by harpa_ai

  • @BetterSachet
    @BetterSachet 9 หลายเดือนก่อน +3

    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 !

  • @aishikmondal350
    @aishikmondal350 11 หลายเดือนก่อน +3

    Sir you are excellent. 😊

  • @ivanzq21
    @ivanzq21 7 หลายเดือนก่อน +1

    I like the high quality video its great

  • @Jorgerodriguez-cf5vy
    @Jorgerodriguez-cf5vy 7 หลายเดือนก่อน

    You are awesome!!!

  • @Roman-oo4tz
    @Roman-oo4tz ปีที่แล้ว

    Thank you 😊

  • @ghettoslick2000
    @ghettoslick2000 ปีที่แล้ว

    Thanks

  • @IMMWICKED
    @IMMWICKED 11 หลายเดือนก่อน +1

    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

    • @MohaleMohale
      @MohaleMohale 10 หลายเดือนก่อน

      initialize your k with 0 k=0

  • @BugHunterMdSam
    @BugHunterMdSam 2 หลายเดือนก่อน

    thank you

  • @DipakShende-oe9pn
    @DipakShende-oe9pn 6 หลายเดือนก่อน +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

  • @shruthij5838
    @shruthij5838 10 หลายเดือนก่อน

    sir please do a playlist of dsa with python

  • @akulasaitejaswani7662
    @akulasaitejaswani7662 ปีที่แล้ว +1

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

  • @ShradhaGuntuk
    @ShradhaGuntuk 27 วันที่ผ่านมา

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

  • @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

  • @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.

  • @trickrunner4842
    @trickrunner4842 2 หลายเดือนก่อน

    couldnt you also just make j=9 and j

  • @StarK24769
    @StarK24769 หลายเดือนก่อน

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

  • @commonmansupport9766
    @commonmansupport9766 4 หลายเดือนก่อน

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