Forums Register Login

Difference in "println" statements...

+Pie Number of slices to send: Send
What is the difference between the "system.out.println" and "system.err.println" statements?

Why is the "system.err.println" statement used when displaying the error message obtained from an exception?

I know that there is a reason, I'm just curious what it is.

Thanks,

Landon
+Pie Number of slices to send: Send
From the API documentation for System.err...

...By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.


Does that help?
+Pie Number of slices to send: Send
hi Landon Blake,

You will find your answer in this thread..

System class and available methods

regards,
[ August 08, 2006: Message edited by: saif uddin ]
+Pie Number of slices to send: Send
most operating systems i am aware of have two output streams - standard out and standard error. usually, both go to the screen.

however, sometimes, you may want to separate where they go. say you're running a script or program that produces some output. you want to save the output to a file. but you also want to know when you encounter a bad record. however, you don't want to mix your error messages with your good data.

you can print your data to the .out, and direct it to one file, and your error messages to .err and direct it to a different file.
+Pie Number of slices to send: Send
This makes perfect sense. I want to thank all responders for taking the time to explain the difference.

Landon
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 480 times.
Similar Threads
difference 061 & '\61'
out or err?
string object
String Question
diff between System.out and System.err
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:47:49.