Question: Q-1:How to use the following Syntax in Java: (Scanner next Line Method) String nextLine() returns the remaining input on the line as a String while
Q-1:How to use the following Syntax in Java: (Scanner next Line Method)
String nextLine()
returns the remaining input on the line as a String
while ( input does not match type requirested )
{flush input
reprompt}
read the good input
Q-2: Please give an example using following syntax:
do
{//code to play a game
System.out.print("Play again (yes/no)?"}
String answer=scan.next();
}while (answer.equalsIgnoreCase("yes")}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
