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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Java error code 
 

Java Error code are the set of error that occurs during the compile-time and Run-time. From java error we have given you a sample of code that makes you to understand the java error code in a better way.

 

Java error code

                         

Java Error code are the set of error that occurs during the compile-time and Run-time. From java error we have given  you a sample of code that makes you to understand the java error code in a better way.

Understand with Example

In this Tutorial we want to describe you a code that help you in understanding a Java error code. For this we have a class name 'Error code'. Inside the main method we have an array list that is used to store when there is a large variation in the amount of data to be taken. The array hold the constant amount of data like number of month in a year, but unlike array list  there is no upper bound for the array list. The list is used to add integer as a wrapper because array list never hold the primitive data in the try block. There is a subsequent a catch block is after the try block to caught the exception occurred in the try block.

On execution the given code, the prompt will show you an Null pointer exception, because we do not specify the size of an array. This result in java error code.

JavaErrorCode

import java.util.*;

public class Errorcode {

    public static void main(String[] args
        {

        ArrayList list = null;
        try {
            list.add(1new Integer(1));
        catch (Exception ex) {
            System.out.println(ex);
        }
    }
}

Output

compile-single:
run-single:
java.lang.NullPointerException
BUILD SUCCESSFUL (total time: seconds)

For removing this runtime error you have to specify the size of the Array.

Download code

                         

» View all related tutorials
Related Tags: c class ant help property get tutorial name ria this for to e des pe in as sta m nt

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.