• Post Reply Bookmark Topic Watch Topic
  • New Topic

NullPointerException  RSS feed

 
Mark Nasr
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I am trying to make an instance of a class that has the parameter of this class in its constructor, but its giving me null pointer exception.

 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

To get a null pointer exception, you actually need to use a null reference. There are no reference usage in the code that you have shown.

Are you sure it is where you say it is happening? Do you have a stack trace to confirm it?

Henry
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have nothing in that code which is null. The error is occurring elsewhere. I shall join this discussion with your other thread because I think they are both about the same problem.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I merged your stuff with the following thread. I hope that is okay by you.
 
Mark Nasr
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me find why these 2 classes giving me NullPointerException? I know its a lot of code but bear with me guys.





There are another 2 classes that I didn't post here
I get NullPointerException on
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by looking at the stack trace printed out as the program stops. That will tell you where the error occurs.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use AWT classes like Frame. Use JavaFX classes or Swing.
 
Mark Nasr
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Mark Nasr,
I have merged your topic into this topic. I hope that helps.

Thanks, but I already fixed the problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!