java while loop break

Solutions on MaxInterview for java while loop break by the best coders in the world

showing results for - "java while loop break"
Liah
30 Sep 2018
1public class Test {
2
3   public static void main(String args[]) {
4      int [] numbers = {10, 20, 30, 40, 50};
5
6      for(int x : numbers ) {
7         if( x == 30 ) {
8            break;
9         }
10         System.out.print( x );
11         System.out.print("\n");
12      }
13   }
14}
15
Shanna
28 Aug 2016
1while (true) {
2    ....
3    if (obj == null) {
4        break;
5    }
6    ....
7}