Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 votes

Why is it necessary that we have a "System.out.println" statement in order to have an "output.printlin" statement?

asked in CSC211_Winter2018 by (1 point)

2 Answers

+3 votes
 
Best answer

the output.println statement prints it in the new text file created in the PrintStream statement
the system.out.println will just print in your console

answered by (1 point)
selected by
+2 votes

It is not necessary to have both.

If you just want the output to go to the file, then use printf, print, or println with the PrintStream object that has been declared and connected to the file.

If you just want the output to go to the console window, then use System.out as the PrintStream so System.out.print...

In our lab, we sent the same output to both the console window and the file. In some of the test practice problems, that is not the case.

answered by (1 point)
edited by
...