aspose file tools*
The moose likes Beginning Java and the fly likes out or  err? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "out or  err?" Watch "out or  err?" New topic
Author

out or err?

Mike Shn
Ranch Hand

Joined: May 26, 2001
Posts: 149
Do these both statements are equal or not?
System.out.println(arg[i]); System.err.println("NY");
Thanks
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
By default both out and err point at the console. However you CAN point them at different places if you so choose.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Michael Bruesch
Ranch Hand

Joined: Sep 23, 2001
Posts: 158
Just as Cindy said (she is always correct), by default err and out print to the same place, the console. You can redirect either to print to your preference of locations. As far as I know, there are err and out only for purposes of the programmer. If you want to specify something as an error, or just want to see when a certain condition occurs, you can print it to err on the console. You can then send the out stuff to a file, for example, and the err messages won't get mixed up with the out stuff. It basically gives you 2 means by which to print things. That explanation was not very good, but I hope it helps a little.
------------------
Michael J Bruesch
Codito, ergo sum...
I code, therefore I am.
My Java Games, I'm quite proud


Michael J Bruesch<br /><i>I code, therefore I am.</i>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: out or err?