Question: Which of the following is the correct syntax to declare a Scanner to read the file example.txt in the current directory? a. Scanner input =
Which of the following is the correct syntax to declare a Scanner to read the file example.txt in the current directory?
a. Scanner input = new Scanner("C:\example.txt");
b. Scanner input = new Scanner(new File("example.txt"));
c. Scanner input = new File("\\example.txt");
d. File input = new Scanner("/example.txt");
e. Scanner input = new Scanner("C:/example.txt");
Step by Step Solution
3.25 Rating (183 Votes )
There are 3 Steps involved in it
Correct syntax to declare a ... View full answer
Get step-by-step solutions from verified subject matter experts
