Solved

Assume That InputFile Is a Scanner Object Used to Read

Question 56

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

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents