Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / ranganathkini

P.S. Please correct the questions. It is not:
Difference between ?System.out.println? and
?System.error.println??

It must be:
Difference between ?System.out.println? and
?System.err.println??

The java.lang.System provides 3 static fields System.out,
System.err and System.in which represent the standard output
stream, standard error stream and standard input stream

Standard Output stream connects the program to the system
console screen and is commonly used to display informative
messages to the user.

Standard Error stream by default connects the program system
console screen and is commonly used to display error
messages to the user.

The Standard Input stream connects the program to the system
keyboard device and provides capability to the program to
read from keyboard input.

Java provides facilities by which these streams can be
redirected to other sources or destinations and change the
way the program behaves.

For example, the standard error stream can be redirected to
a output stream that writes to a log file for error analysis.

Is This Answer Correct ?    51 Yes 4 No

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

Answer / ravikiran

out.println will print the output to an output stream.
err.println will print the errors to the stream

Is This Answer Correct ?    22 Yes 5 No

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

Answer / unknown

out for stream
err for display error

Is This Answer Correct ?    9 Yes 1 No

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

Answer / 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

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

Answer / narendrakumar

System.out.println(""); are used for displaying the data on
the console monitor and also send the data to the files...

But In System.err.println(""); mainly used for displaying
the err msg on the console monitor(stderr(standard
error))But we
cannot send the data to the file...only console monitor

Is This Answer Correct ?    4 Yes 0 No

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

Answer / 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

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

Answer / jyoti

System.setErr() needs to be used for redirection. '>' is
used for Operating system console redirection.

Is This Answer Correct ?    0 Yes 0 No

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

Answer / pratima

Display normally whatever you want to display
System.out.println("Hello")


Display Error messaage
System.err.println("Hello")
o/p:-Hello(In red color)

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is Recursion Function?

0 Answers   iNautix,


What is jar?

0 Answers  


why java does compile time polymorphism at run time ?

6 Answers   CTS, TCS,


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

0 Answers   HCL,


Describe what a thread-local variable is in java?

0 Answers  


Can an interface extend another interface?

0 Answers  


How do you use compareto?

0 Answers  


Every class extends object but why it is not possible for every object to invoke clone() method. ideally protected methods should be accessible from sub classes. isn't it?

2 Answers  


What is the default modifier in Interface?

5 Answers  


What is collection class in java? List down its methods and interfaces.

0 Answers  


What is the difference between throw and throws in java?

0 Answers  


What are different types of encoding?

0 Answers  


Categories