Ask Question
27 September, 17:14

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 = = " ")

+4
Answers (1)
  1. 27 September, 19:49
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers