File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NullPointerException" Watch "NullPointerException" New topic
Author

NullPointerException

Lio Liov
Ranch Hand

Joined: Mar 21, 2012
Posts: 33
I have null pointer exception and My code ,could you help fixing it
Thanks

Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Stacktrace would help.
dennis deems
Ranch Hand

Joined: Mar 12, 2011
Posts: 808
The String array is never instantiated. It is explicitly set to null, and is still null when you try to write a String to one of its indices.
Lio Liov
Ranch Hand

Joined: Mar 21, 2012
Posts: 33
Thanks ,can I instantiate the array without specified the size
Stefaan Dutry
Ranch Hand

Joined: Sep 17, 2010
Posts: 32

Lio Liov wrote:can I instantiate the array without specified the size


I would suggest looking at, and using ArrayList.
Especialy it's add method and it's toArray method.

Although i can't think of a reason to convert it to an Array again in this case.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException