I started coding small program in Java. I wanted to exercise try-catch block, but i did not even come to that part and got stuck on loop part. I know this is very basic loop
Maybe you can try the following code. In your code , it's not need to use iteration.
choice = input.nextInt(); while (choice != 1 && choice != 2) { System.out.println("Invalid entry, press 1 or 2"); choice = input.nextInt(); }