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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!