Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException

 
Lio Liov
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have null pointer exception and My code ,could you help fixing it
Thanks

 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stacktrace would help.
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ,can I instantiate the array without specified the size
 
Stefaan Dutry
Ranch Hand
Posts: 32
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic