Blog Introductions
In this  blog contains tutorials about  HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials,  Examples, Source code,Learning,
Tips and Software development  services. 
Java Loops for loop while loop do while loop  | Java tutorials Bestitworriors



Java Loops for loop while loop do while loop                   

Java tutorials


Java Loops for loop while loop do while loop  | Java tutorials Bestitworriors - Java loops are use to execute a block of code for many times untill specific condation match . Java support for,while , do while loops.The purpose is same for all loop but use according to given condation.Java loops are very usefull for iterate the block of code multipull time.



Some Key Points of Java Loops





  1. Java loops iterate multipull time untill given condation occure
  2. If you know the iteration time you can use for loop instead of while loop
  3. Do while loop execute block of code first and then check the condation
  4. We can use continue and break statements in the loops
  5. Continue statement use skip the current iteration
  6. Break statement use to jump out of loop when condation match
  7. Loop are best practice for iterate the block of code


Code



public


class loopss {

public static void main(String[] args) {

int var1 = 0;


while (var1 < 5) {
System.out.println(var1);

if (var1 == 3) {
break;
}
if (var1 == 2) {
var1 + +;
continue;
}
var1 + +;
}

int
var2 = 0;
do
{
System.out.println(var2);
var2 + +;
}
while (var2 < 5);

for (int var3 = 0; var3 < 5; var3++) {
System.out.println(var3);
}

String[]
Months = {"January", "Feburary", "March", "April"};
for (String i: Months) {
System.out.println(i);
}

}

}










Out Put




0
1
2
3
0
1
2
3
4
0
1
2
3
4
January
Feburary
March
April




I hope You really enjoyed this blog . I try my best to make every thing is easy and helpfull to provide to public .You will get more blog about the Programing project and code . Thanks for visiting my blog if you have any querry related to this you can comment here i will try my best to response you back about Java Loops for loop while loop do while loop  | Java tutorials Bestitworriors