Ask Question
9 February, 19:02

Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the correct way to read data from the file until the end of the file is reached?

a) while (inputFile! = null)

b) while (! inputFile. EOF)

c) while (inputFile. hasnextInt ())

d) while (inputFile. nextLine = = " ")

+2
Answers (1)
  1. 9 February, 19:56
    0
    The correct answer to the following question is an option c) while (inputFile. hasnextInt ()).

    Explanation:

    hasnextint () is the function of the scanner class which is "java. util. Scanner".

    This method returns the boolean value so the data type of this method is boolean.

    Integer values of radix are assumed only when a next token is in the Scanner input and it returns output True.

    The other options are false because the input file can be null and the end of file is not equal to the input file and the next line is equal to the space and also the other options are not the object of the scanner class.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the correct way ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers