Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java error class 
 

Java error class is subclass of throw able class. This mean the application does not able to catch the error occurred in the try block. These error occurred due to abnormal condition.

 

Java error class

                         

Java error class  is  subclass of throw able class. This mean the application does not able to catch the error occurred in the try block. These error occurred due to abnormal condition. The error class and its subclass define the object to be thrown and the message to be appear what the error occurred. Let us understand a condition stack overflow error occurs when you call a recursive and there is no any way  to fix the problem in catch block. The only way to resolve the problem is you need to show the error message that occurred in your code.

Understand with code

In this Tutorial we want to describe you a code that help you in understanding Java error code. For this we have a class name Error class. Inside the main method we assign an instance of error class with a specified detail message.

1)e.getMessage( )  -This method return you an error message string of the throw able object.

2)e.getClass( )       -This method return you an error specified in the class.

Finally the System.out.print ln is used to print the message of the error stored in string  variable s as output on command prompt.

Errorclass.java

import java.lang.*;
public class Errorclass {

    public static void main(String[] args) {
        Error e = new Error("Error have been defined manually");
        String s = e.getMessage();
        System.out.println("Class name of this error is: " + e.getClass());
        System.out.println("Message of this error is: " + s);
    }
}

Output

Compiling source file to /home/girish/NetBeansProjects/errors/build/classes
compile-single:
run-single:
Class name of this error is: class java.lang.Error
Message of this error is: Error have been defined manually
BUILD SUCCESSFUL (total time: second)

Download code

                         

» View all related tutorials
Related Tags: java c mac process io virtual vi number this sso ai processor to proc e il section machine ce in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.