Which of the following will open a file named MyFile.txt and allow you to read data from it?
A) File file = new File("MyFile.txt") ;
B) Scanner inputFile = new Scanner("MyFile.txt") ;
C) File file = new File("MyFile.txt") ;
Scanner inputFile = new Scanner(file) ;
D) PrintWriter inputFile = new PrintWriter("MyFile.txt") ;
Correct Answer:
Verified
Q1: The do-while loop must be terminated with
Q6: When the continue statement is encountered in
Q7: When you open a file with the
Q14: Java provides a set of simple unary
Q18: The while loop has two important parts:
Q36: What will be printed after the following
Q40: A loop that executes as long as
Q41: Assuming that inputFile references a Scanner object
Q42: This is an item that separates other
Q43: This type of loop is ideal in
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