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

Answer Posted / k.v.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.err.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 ?    7 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is annotation in java?

578


What are the types of casting?

603


Explain method local inner classes ?

597


How can a gui component handle its own events in java programming?

545


How is a variable stored in memory?

535






What is the mapping mechanism used by java to identify IDL language?

595


How do I start learning java?

565


Can we use string in switch case in java?

574


What is serialization in java?

570


How can you read an integer value from the keyword when the application is runtime in java? example?

629


Which sorting algorithm is best in java?

540


Is null an object in java?

568


Explain about anonymous inner classes ?

584


Is array passed by reference in java?

585


What is another word for methodology?

521