Solved

Consider the Following Code Snippet: Scanner in = New Scanner

Question 11

Multiple Choice

Consider the following code snippet: Scanner in = new Scanner(. . .) ;
) . .
If (in.hasNext() )
{
Throw new IOException("End of file expected") ;
}
Which of the following statements about this code is correct?


A) The program will display the message "End of file expected" if there is no data.
B) The program will throw an exception if there is no data.
C) The program will display the message "End of file expected" if there is data left in the input when the if statement is executed.
D) The program will throw an exception if there is data left in the input when the if statement is executed.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions