• Post Reply Bookmark Topic Watch Topic
  • New Topic

Body Mass Index Calculator GUI error  RSS feed

 
Cris Kris
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am in the process of learning how to create GUI. I am buliding a BMI Calculator but i am keep getting this error and cannot find out why, can someone help please?
Exception in thread "main" java.lang.NullPointerException
at Source.<init>(Source.java:21)
at Main.main(Main.java:5)



 
Norman Radder
Ranch Hand
Posts: 146
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception in thread "main" java.lang.NullPointerException
at Source.<init>(Source.java:21)

Look at the statement on line 21 and find the variable with the null value.  Use a print statement to print all the variables on the line if you can't find the one with null.
Then backtrack in the code to see why that variable does not have a valid value.
 
Norman Radder
Ranch Hand
Posts: 146
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: The code tags don't surround the code making it harder to read.
 
Norman Radder
Ranch Hand
Posts: 146
4
 
Knute Snortum
Sheriff
Posts: 4270
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Norman.  The OP has gotten someone to help him over at that forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!