Null pointer exceptions occur when you try to call a method on an object that is null. Try to determine why that is happening in your code.
Ezzaral
null
16,126 posts since May 2007
Reputation Points: 3,294
Solved Threads: 875
Skill Endorsements: 28
Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5
That completely depends on whether the OP intends to write the program in an object-oriented manner or a procedural manner.
Ezzaral
null
16,126 posts since May 2007
Reputation Points: 3,294
Solved Threads: 875
Skill Endorsements: 28
Yes i do understand Ezzaral, thats why i showed the three possibilities to call the class without getting an error or null pointer.
But you added those in an edit after I posted ;)
I didn't say your original post was wrong. He can certain make it work by changing the method to static. I just pointed out that it may not apply if he was trying to use objects and methods.
You did however give him three solutions to the program without having to think about correcting anything at all himself.
@boris: Glad you resolved your errors.
Ezzaral
null
16,126 posts since May 2007
Reputation Points: 3,294
Solved Threads: 875
Skill Endorsements: 28