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:
Verified
Q51: Insert the missing code in the following
Q52: Assuming that inputFile is a Scanner object
Q53: When reading words using a Scanner object's
Q54: Assume that inputFile is a Scanner object
Q55: Consider the following code snippet: Scanner in
Q57: Insert the missing code in the following
Q58: When reading words with a Scanner object,
Q59: Consider the following code snippet. File inputFile
Q60: Which of the following patterns should be
Q61: Select an expression to complete the program
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents