Home Java Java-get-example Java error stream
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Java error stream

Advertisement
The Java error stream is used to print error that arises during the execution of a program.

Java error stream

     

The Java error stream is used to print error that arises during the execution of a program. The execution of program display an output and error to the different stream that allows the user to move them to different pages thereby isolating them. The output stream is used for command output, that is used to print the output of a command to a user.

Understand with Example

In this Tutorial we want to describe you a code that help you to understand java error stream, For this we have a class name'errorstreamexample'.Inside the main method if we have the length of the argument is not equal to 1.The System.err.println  display an message as passed in the argument of it. The  most often used from class System are the standard output error and standard error stream, these are the variable of System class.

System.err.println-This is Similar to System.out.println that is used to print the result.

errorstreamexample.java
public class errorstreamexample {

  public static void main(String[] args) {
 if(args.length!=1){
 System.err.println("usage: java.run.pathname");
 return;
 }
  }

}

Output


Download code

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: November 3, 2008

Ask Questions?    Discuss: Java error stream  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com