Difference between ?System.out.println?
and ?System.error.println??

Answer Posted / subrahmnyareddy

We can redirect System.out to another file but we cannot
redirect System.err stream.

ex:
public class TestSystOutAndErr
{
public static void main(String[] args)
{
System.out.println("system.out.message");
System.out.println("system.err.message");
}
}
compile:
>javac TestSystOutAndErr.java

execute:(first time)

>java TestSystOutAndErr

OutPut:
system.out.message
system.err.message

execute:(second time)

>java TestSystOutAndErr > samp.txt

output:
system.err.message
(In the above execution "system.out.message" redirected in
to samp.txt file but "system.err.message" not redirected
into samp.txt file)

request:

hi,
I'm M.C.A studet if there is an wrong plz excuse me.
tnaq

Is This Answer Correct ?    13 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does java se mean?

584


What is an object's lock and which object's have locks in java programming?

563


What is api data?

530


What is replacefirst in java?

567


Explain the access modifiers for a class, method and variables?

649






What is package private scope in java?

532


How many types of flags are there?

519


What is a treeset class?

555


Why is it called buffering?

582


what are abstract functions?

557


why would you use a synchronized block vs. Synchronized method? : Java thread

530


What is annotation in java?

571


Are arrays classes in java?

530


What are the methods of object class ?

559


What is the difference between dom and sax parser in java?

526