Skip to main content

Exception in thread "main" java.lang.NullPointerException

1 reply [Last post]
yotamoo
Offline
Joined: 2010-09-22
Points: 0

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(DataBase.java:7)
    at mainpage.main(mainpage.java:5)
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.
Thanks!

Reply viewing options

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