Welcome to the CSC Q&A.
Get help and give help!
Write great code!
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 (863 points)

2 Answers

+2 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 (432 points)
selected by
+1 vote

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 (3k points)
edited by
...