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

Explain when noclassdeffounderror will be raised ?

619


How to do encapsulation in java?

572


What are the 3 types of control structures?

531


Explain about collection interface in java?

549


For ease of programming you can consider the maze as a 2D array with colors represented by below integer and characters (in capital letters). • B - Black • W -White • G- Green • R- Red R B W B W W W W W W B W B B W W W W W W W B W B W W W B W W W W B B W W W B W W W B W W B B B B W B W B W W B W W W B W W W B B B W W B W W W B W W B W B W W W B W B W W W W B B W W W W B W W W W W G Shortest Route Problem: • Solution that finds the shortest Route between Red and Green  White will have 1 Weight.  Red and Green carry no weights.  Shortest path is the path with less weight when you add up the weights in the path.

1585






What is the use of parseint in java?

537


What is lazy initialization in java?

556


What is Java Reflection API? Why it’s so important to have?

605


What is downcasting?

576


What are the advantages of passing this into a method instead of the current class object itself?

1174


State two differences between C and Java.

695


What are methods of a class?

544


What is linked hashmap and its features?

547


Can we write a class without main method in java?

487


When to use runnable interface vs thread class in java?

526