// int i=0;
// while(i<5){
// System.out.println(i);
// System.out.println("Java is great.");
// if (i==2){
// System.out.println("Ending the Loop.");
// break;
//
// }
// i++; //DOUBT:WHEN I WRITE i++ AFTER 4TH LINE WHY "2" IS NOT PRINTED IN OUTPUT.
// }
// int i=0;
// do{
// System.out.println(i);
// System.out.println("Java is Great.");
// if (i==2){
// System.out.println("Ending the Loop.");
// break;
// }
// i++;
// } while (i<5);
// for (int i=0; i<50; i++){
// if (i==2){
// System.out.println("Ending the Loop");
// continue;
// }
// System.out.println(i);
// System.out.println("Java is Great.");
// }
int i=0;
do{
i++;
if(i==2){
System.out.println("Ending the loop.");
continue;
}
System.out.println(i);
System.out.println("Java is Great.");
}while(i<5);
//DOUBT:WHY 5 IS GETTING PRINTED IN THIS EVEN IF THE CONDITION IS (i<5).
Basically in all these codes my doubt is how can i decide the exact posiiton of certain codes to get the appropriate results. Like when i write i++; above the if statement and after the if statement then different results gets printed.