class Ideone{ public static void main (String[] args) { int k = 0; while(true) { System.out.println("Current k = " + k); if( k == 10) { System.out.println("Break outside loop"); break; } k++; } }}
Standard input is empty
Current k = 0 Current k = 1 Current k = 2 Current k = 3 Current k = 4 Current k = 5 Current k = 6 Current k = 7 Current k = 8 Current k = 9 Current k = 10 Break outside loop
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!