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
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: 9302
    
  17

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class initialization error!