Solved

Assume That InputFile Is a Scanner Object Used to Read

Question 1

Multiple Choice

Assume that inputFile is a Scanner object used to read data from a text file which contains a number of lines. Some lines contain an alphabetic string, while others contain a single integer value. Select an expression to complete the following code segment, which counts the number of integer values in the input file.
Int count = 0;
While (inputFile.hasNextLine() )
{
If (________________________________)
{
Count++;
}
InputFile.nextLine() ;
}
System.out.println(count) ;


A) inputFile.hasNext()
B) inputFile.hasNextInt()
C) inputFile.nextInt()
D) Character.isDigit(inputFile.next() )

Correct Answer:

verifed

Verified

Related Questions