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 Scanner = new File("MyFile.txt");
d. PrintWriter inputFile = new PrintWriter("MyFile.txt");

b. File file = new File("MyFile.txt");
Scanner inputFile = new Scanner(file);

Computer Science & Information Technology

You might also like to view...

The Single File Web Page option to save a Word document as a Web page is supported only by Internet Explorer

Indicate whether the statement is true or false

Computer Science & Information Technology

Reports can draw data from tables or queries

Indicate whether the statement is true or false

Computer Science & Information Technology