1.

Solve : java.lang.NullPointerException?

Answer»

I am a beginner in Java programming, and I am writing my first program. I am really enjoying it, but now I have a problem which I cannot solve. Each time I am building the code I dont get any error, but when I run it the following error is displayed.

Exception in thread "MAIN" java.lang.NullPointerException

The code is the following :

public class MAINCLASS {

public static void main(String args[]) {

Case[] CASES = new Case [2];
INT c_location, s_location, ISBN_no;



for(int counter1 = 0; counter1 < 2; counter1 ++ ){
for(int COUNTER2 = 0; counter2 < 5; counter2 ++ ){
for(int counter3 = 0; counter3 < 20; counter3 ++ ){

cases[counter1].shelf[counter2].book[counter3] = new Book((counter3),(counter3 + 1),(counter3 + 2));

}
}
}

}

}


Any help please ?



Discussion

No Comment Found