class BreakExample { public static void main(String[] args) { System.out.println("(Please enter a number from 1 to 6)"); ConsoleReader console = new ConsoleReader(System.in); int num = console.readInt(); System.out.println("(Please enter another number, from 1 to 8)"); ConsoleReader console2 = new ConsoleReader(System.in); int num2 = console2.readInt(); for(int num = 1; num < 6; num++) { for(int num2 = 1; num2 < 8; num2++) { if(num == 4 && num2 == 1) { System.out.println("keep the loop going when the numbers are: " +num+ " and " + num2); continue; } if( num == 5 && num2 == 3 ) { System.out.println( "Break the loop when the numbers are: " +num+ " and " + num2); break; } System.out.println("Continue with the loop when the numbers are: " +num+ "and " + num2); } } } }
The user input with this program doesn't work. I'm having a problem with the variables that I can't seem to figure out. Any ideas on how to get this to work?