Home Java Java-get-example Java error code



Java error code
Posted on: November 3, 2008 at 12:00 AM
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.

3">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

Related Tags for Java error code:
javacerrorcomtimemakecompileuripilsetsamplempitoruneilimfromincompile-timestamjesrun-timepimesatkhaimeivcompile-timemplduandarcodcodeccsavattssamssamriringthavsthatpleplndodeomo


More Tutorials from this section

Ask Questions?    Discuss: Java error code   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.