Solved

Import Java.nio.file.*; Import Java.io.*;

Question 76

Essay

import java.nio.file.*;
import java.io.*;
public class ReadFile
{
    public static void main(String[] args)
   {
       Path file = Paths.get("C:\\Java\\Input.Output\\Grades.txt");
       InputStream input = null;
       try
      {
          ----Code here-------
          ----Code here-------
           String grade = null;
           grade = reader.readLine();
           System.out.println(grade);
           input.close();
       }
       catch (IOException e)
      {
          System.out.println(e);
       }
   }
} In the code above, a ReadFile class reads from the Grades.txt file. A path is declared, and an InputStream is declared using the Path . In the first indicated line, create the statement to assign a stream to the InputStream reference. In the second indicated line, declare a BufferedReader that reads a line of text from a character-input stream that buffers characters for more efficient reading.

Correct Answer:

verifed

Verified

input = Files.newInputStream(f...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents