Write a statement that will create a stream named fileIn tha

Write a statement that will create a stream named fileIn that is a member of the class Scanner. It should connect the stream to a text file named “sally.txt” so that your program can read input from the text file sally.

Solution

Answer:

The statement that will create a stream named fileIn that is a member of the class Scanner and connect the stream to a text file named “sally.txt” is given as below :

File input = new File(\"C:/temp/sally.txt\");

Scanner filen = new Scanner(input);

Write a statement that will create a stream named fileIn that is a member of the class Scanner. It should connect the stream to a text file named “sally.txt” so

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site