ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
   
 
Categories  >>  Software  >>  Java Related  >>  Java J2EE  >>  Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Difference between ?System.out.println? 
and ?System.error.println??
 Question Submitted By :: Bskumar78
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 1
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 ?    41 Yes 2 No
Ranganathkini
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 2
out.println will print the output to an output stream.
err.println will print the errors to the stream
 
Is This Answer Correct ?    19 Yes 4 No
Ravikiran
 
 
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 3
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 ?    12 Yes 7 No
Subrahmnyareddy
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 4
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 ?    5 Yes 5 No
K.v.subrahmnyareddy
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 5
out for stream
err for display error
 
Is This Answer Correct ?    6 Yes 0 No
Unknown
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 6
System.setErr() needs to be used for redirection. '>' is
used for Operating system console redirection.
 
Is This Answer Correct ?    0 Yes 0 No
Jyoti
 
  Re: Difference between ?System.out.println? and ?System.error.println??
Answer
# 7
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 ?    2 Yes 0 No
Narendrakumar
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Can an interface extands a class?  5
what is difference between throw and throws in exception?  48
Linked List reverese program Bally-Technologies2
Default layout of panel and frame?  3
how to transactions(Bank transactions) in business process in ejb? Photon1
whats is inheritance? HCL14
Write program to print Hello World and print each character address in that string and print how many times each character is in that string? Ex: H: 0 & 1 e:1 & 1 l :2,3,8 & 3 o:4,6 & 2 w:5 & 1 r: 7 & 1 d 9 & 1 Huawei7
My interview asked what is dynamic variable in java and where we use them. IBM2
what is mean by method signature? Satyam7
What is the use join() in Threads ? HCL5
what is Abstract DataType?  1
What is the difference between Trusted and Untrusted Applet ? IBM2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com