About Lesson
In this lecture we will learn:
– What are loops in Java?
– Different kinds of loops
– Need for loops in Java
#1
Loops in Java is a feature used to execute a particular part of the program repeatedly if a given condition evaluates to be true.
– We use loops, when we have to execute a same statement multiple times.
– In Java, we have different types of loops:-
- while loop
- do while loop
- for loop
– Different type of loops have different kind of use- cases like a finite number of times or based on some condition.
#2
Need of loops in Java:-
– It reduce the size of the code.
– Loops make an easy flow of the control.
– Loops reduce the time complexity and space complexity.