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 is the effect of keeping a constructor private?

686


Do you know how to reverse string in java?

827


How do you convert an int to a double in java?

811


How many types of voids are there?

761


Explain notifyall() method of object class ?

870


What is replacefirst in java?

786


Why is it called a string?

756


Which is bigger float or double?

765


What do you mean by constructor?

741


What is the purpose of file class?

765


What is the use of static methods?

804


Does google use java?

752


Do we need to manually write Copy Constructor?

793


What is the Scope of Static Variable?

962


Are arrays immutable in java?

758