Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

out or err?

 
Mike Shn
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do these both statements are equal or not?
System.out.println(arg[i]); System.err.println("NY");
Thanks
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default both out and err point at the console. However you CAN point them at different places if you so choose.
 
Michael Bruesch
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic