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

Why we use protected in java?

544


What is Recursion Function?

656


What is a private class in java?

514


What are the types of casting?

605


What string is utf8?

555






Can singleton class be inherited in java?

524


What are different types of arrays?

542


What is object-oriented paradigm?

625


Is nan false?

541


Explain how can you debug the Java code?

597


Which list is sorted in java?

587


When is finally block not called?

586


What is a java applet? What is an interface?

637


What happens if we override private method?

537


What is thread pool? How can we create thread pool in java?

635