Hi guys , I dont have idea on how to solve this problem . I attach my question but I dont know whether it is true or not.
Can you please help me

Given an output file named "data.txt" write the code fragment to

i ) set up the file and output stream 

ii) write the value of 101 to the stream 

iii) close the stream 

Tqvm

My Answer :

i) import java.io.*;

   File outFile = new File ("data.txt");
   FileOutputStream outFileStream  = new FileOutputStream(outFile);
   PrintWriter      outStream      = new PrintWriter(outFileStream);

 ii) outStream.println(“101”);

 iii) outStream.close();

what's supposed to be true? I can't look into the brain of your teacher, but I assume if he hands you an assignment it's a true assignment...

sorry i mean it's my answer correct ? can I test it ? I thought it can not be compile by eclipse

if it can't be compiled, it isn't correct.
obviously, what you've written above is not the entire code you should write to run it.

This question has already been answered. Start a new discussion instead.