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

Can a class be private or protected in java?

547


Explain the use of sublass in a java program?

596


What is the unit of plancks constant?

565


what r advatages of websphere? & how to deploy?

1632


What is class and object in java?

545






What is the return type of the main method?

571


How to sort a collection of custom Objects in Java?

594


Difference between string s= new string (); and string s = "abv";?

736


What is multithreading in java?

543


How do you break a loop?

559


What is a generic code?

524


How static variable work in java?

591


What is string builder in java?

552


Explain where variables are created in memory?

578


What is a vararg?

544