135k views
2 votes
Given a PrintWriter reference variable named output that references a PrintWriter object, write a statement that writes the string "Hello, World" to the file output streams to.

User Batool
by
5.1k points

1 Answer

2 votes

Answer:

output.write("Hello, World")

Step-by-step explanation:

A printWriter object (An instance of a class) is contained in a variable called output, to access the write method we use the dot (.) operator to access the write method of the output object and hence, output.write() outputs any string it takes as argument. this is a very interesting OOP (Object oriented programming concept).

User Dganenco
by
5.8k points