Write a line of code to create a Print Writer to write to th
Write a line of code to create a Print Writer to write to the file \"out.txt\", and then another line that writes your name to the opened file. Do not worry about the try-catch.
Solution
PrintWriter pw = new PrintWriter(new File(\"out.txt\"));
pw.println(\"The Dark passenger\");
// complete code:
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class vehicle {
public static void main(String args[]) throws FileNotFoundException{
PrintWriter pw = new PrintWriter(new File(\"out.txt\"));
pw.println(\"The Dark passenger\");
pw.close();
}
}
