Sentinel issue with loop to allow to enter quit to end program in java
问题 I'm having trouble at the bottom part where i am trying to set the sentinel exit key to quit.. im not sure exactly how i am supposed to do it. int number; do { Scanner Input = new Scanner(System.in); System.out.print("Enter a positive integer or q to quit program:"); number = Input.nextInt(); } while(number >= 0); do { Scanner Input = new Scanner(System.in); System.out.print("Input should be positve:"); number = Input.nextInt(); } while(number < 0); do { Scanner quit = new Scanner(System.in);