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 static block?

826


Is java platform independent?

789


What about anonymous inner classes in java?

817


List implementations of list interface?

819


What are thread priorities and importance of thread priorities in java?

847


How much is a java license?

739


Can a static block throw exception?

879


How can you say java is object oriented?

847


Can you add null to a list java?

813


What is void data type?

779


Which are the two subclasses under exception class?

777


What is difference between core java and java ee?

703


What is class variable java?

811


What is string and its types?

881


Explain methods specific to list interface?

776