Answer:
// The Scanner class is imported to allow the program receive user input
import java.util.Scanner;
// The class is defined called Solution
public class Solution {
// The main method is defined which begin program execution
public static void main(String args[]) {
// Scanner object 'scan' which receive user input from the keyboard
Scanner scan = new Scanner(System.in);
// the userInput variable is initially set to 1 (true) to allow the program continue prompting the user for input
int userInput = 1;
// while loop which continue execution as long as the userInput is greater than 0 and less than 10
while (userInput > 0 && userInput < 10){
// Prompts is displayed to the user to enter number below 10
System.out.println("Enter a positive integer under 10:__________");
// the next input is assigned to userInput
userInput = scan.nextInt();
}
}
}
Explanation:
The above code continue prompting the user to input an integer as long as the input is greater than 0 and less than 10.