Which of the following statements opens a file named MyFile.txt and allows you to read data from it?
A) Scanner inputFile = new Scanner("MyFile.txt") ;
B) File file = new File("MyFile.txt") ; Scanner inputFile = new Scanner(file) ;
C) File file = new File("MyFile.txt") ;
D) PrintWriter inputFile = new PrintWriter("MyFile.txt") ;
Correct Answer:
Verified
Q4: The do-while loop is ideal in situations
Q5: A loop that executes as long as
Q6: When the continue statement is encountered in
Q12: When the break statement is encountered in
Q19: A file must always be opened before
Q31: In a for loop, the control variable
Q32: In general, there are two types of
Q32: Given the following statement, which statement will
Q36: A(n) _ is a special value that
Q40: If a loop does not contain within
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