50.6k views
1 vote
Given a PrintWriter reference variable named output that references a PrintWriter object, write a statement that writes the string "Hello, World" to the file in to which output streams.

User Dave Smith
by
6.6k points

1 Answer

6 votes

Answer:

A PrintWriter reference variable named output that references a PrintWriter object is as follows:

//PrintWriter output = new PrintWriter(outfile);

PrintWriter output = new PrintWriter("output.txt");

The statement that writes the string "Hello World" to the file output is as follows:

//output.print(message)

output.print("Hello World");

Step-by-step explanation:

User Pedro Luz
by
7.0k points