Java Instrukcja break

Wiki Text
Section image
Obraz
Start Loop condition Use... Code after break sta... Stop False True False True Viewer does not support full SVG 1.1
Section body

Instrukcja break przerywa wykonywanie kodu umieszczonego w pętli lub konstrukcji switch.

Section body
int a = 1;
switch (a) {
    case 1:
 	   System.out.println("1");
    case 2:
	   System.out.println("2");
       break;
    case 3: {
	   System.out.println("3");
    } break;
}
/*
1
2
*/