File tree 1 file changed +48
-0
lines changed
1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .company ;
2
+
3
+ public class cwh_24_break_and_continue {
4
+ public static void main (String [] args ) {
5
+ // Break and continue using loops!
6
+ // for (int i=0;i<50;i++){
7
+ // System.out.println(i);
8
+ // System.out.println("Java is great");
9
+ // if(i==2){
10
+ // System.out.println("Ending the loop");
11
+ // break;
12
+ // }
13
+ // }
14
+ // int i=0;
15
+ // do{
16
+ // System.out.println(i);
17
+ // System.out.println("Java is great");
18
+ // if(i==2){
19
+ // System.out.println("Ending the loop");
20
+ // break;
21
+ // }
22
+ // i++;
23
+ // }while(i<5);
24
+ // System.out.println("Loop ends here");
25
+
26
+
27
+ // for(int i=0;i<50;i++){
28
+ // if(i==2){
29
+ // System.out.println("Ending the loop");
30
+ // continue;
31
+ // }
32
+ // System.out.println(i);
33
+ // System.out.println("Java is great");
34
+ // }
35
+ int i =0 ;
36
+ do {
37
+ i ++;
38
+ if (i ==2 ){
39
+ System .out .println ("Ending the loop" );
40
+ continue ;
41
+ }
42
+ System .out .println (i );
43
+ System .out .println ("Java is great" );
44
+
45
+ }while (i <5 );
46
+ System .out .println ("Loop ends here" );
47
+ }
48
+ }
You can’t perform that action at this time.
0 commit comments