aspose file tools
The moose likes Beginning Java and the fly likes Class initialization error! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Class initialization error!" Watch "Class initialization error!" New topic
Author

Class initialization error!

Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147


This goes ok! If i decomment this line
from constructor, i get such error:


What's the problem, i have no idea


If you think you've done too much, usually it means you've done too few.
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Ooops! Problem solved!

I've just put this line:


before these ones:
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9347
    
  19

Vadim, the problem is simple, your individual references are initialized before the ArrayList. That's why the ArrayList is null when you try to add the element to it. Try this sequence of declaration



[Edit: Oops, I'm late ]


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Thanks anyway!
 
Consider Paul's rocket mass heater.
 
subject: Class initialization error!