R4R
Right Place For Right Person TM

what is a the difference between System.err and System.out

previous previous previous
Question:
what is a the difference between System.err and System.out

Question: what is a the difference between System.err and System.out


Answer
The System.out writes to the "standard output". The System.err writes to "standard error". These two streams are setup by the operating system when the Java program is executed, and can be redirected with the uses of "|", ">", etc. on the command line. You can redirect the output of the System.out to any other file. The following example can help to understand the concept : public class Test{ public static void main(String args[]){ System.out.println("Output of System.out"); System.err.println("Output of System.err"); } } First Execution - C:\>java Test Output of System.out Output of System.err Second Execution - C:\>java Test > abc.txt Output of System.err In the second execution we diverted only the std output stream and std err stream remained unchanged. i.e., by this way, we can handle error stream separately.

By:Jalees
Date:

what is a the difference between System.err and System.out

Post Your Answers


User Name:
Answers:

Related Links

  1. What is the difference between synchronized block and synchronized method ?
  2. How can you force garbage collection in java?
  3. How can you call a constructor from another constructor ?
  4. How can you call the constructor of super class ?
  5. What must be the order of catch blocks when catching more than one exception?
  6. How can we call a method or variable of the super class from child class ?
  7. If you are overriding equals() method of a class, what other methods you might need to override ?
  8. What is externalizable ?
  9. Does garbage collection guarantee that a program will not run out of memory?
  10. What is a native method?
  11. What is the difference between a continue statement and a break statement?
  12. What must a class do to implement an interface?
  13. What is the difference between notifyand notifyAll method ?
  14. What does wait method do ?
  15. What are the different states of a thread ?
  16. What is the difference between static and non static inner class ?
  17. What is the difference between readers and streams?
  18. Why we cannot override static methods?
  19. When does a compiler supplies a default constructor for a class?
  20. What will happen if an exception is not caught ?
  21. What are the different ways in which a thread can enter into waiting state?
  22. What is a ResourceBundle class?
  23. What is numeric promotion?
  24. What is the difference between the prefix and postfix forms of the ++ operator?
  25. What is the difference between a switch statement and an if statement?
  26. What is hashCode?
  27. What is the difference between RandomAccessFile and File?
  28. What is the difference among JVM Spec, JVM Implementation, JVM Runtime ?
  29. What is the difference between Hashtable and HashMap ?
  30. Why java is said to be pass-by-value ?
  31. What do you mean by immutable ? How to create an immutable object ?
  32. What is a weak reference ?
  33. What is object cloning?
  34. What is object pooling?
  35. What is the disadvantage of garbage collection?
  36. What are tag interfaces?
  37. What are the restrictions placed on static method ?
  38. What is JIT?
  39. What is the Locale class?
  40. What is the difference between URL and URLConnection?
  41. What are the two important TCP Socket classes?
  42. Strings are immutable. But String s="Hello"; String s1=s+"World" returns HelloWorld how ?
  43. What is classpath?
  44. What is path?
  45. What is java collections?
  46. Can we compile a java program without main?
  47. What is static initializer block? What is its use?
  48. How does a try statement determine which catch clause should be used to handle an exception?
  49. If a class doesn't have any constructors, what will happen?
  50. What will happen if a thread cannot acquire a lock on an object?

Question: what is a the difference between System.err and System.out

Back Home Next

New Updates

Topics

Topics

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R