Skip to main content

Exception in thread "main" java.lang.NullPointerException

1 reply [Last post]
Joined: 2010-09-22

So, i am trying to build a simple database (array of Car type).
the code is quite simple but for some reason i keep getting the same error after running the program (compiling went through). so i have 3 classes:

class DataBase {</p>
<p>    private Car[] database = new Car[3];</p>
<p>    public DataBase() {
    for (int i=0; i(
    at mainpage.main(
yotam@main computer:~/Documents/java/newcar$

i searched for possible reasons and i came across the possibility that the array wasn't initialized, but then i changed to constructor to set model and color to "empty" and year to 0.
so now i have no clue, need your help guys.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-08-05