• Post Reply Bookmark Topic Watch Topic
  • New Topic

Null Pointer Exception Help  RSS feed

 
Ben Jass
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I'm currently getting a Null Pointer Exception in this application that I'm currently making.



I'm currently getting an error at line 105 (this is where the for loop starts, creating JCheckBox objects). I understand what the Null Pointer Exception means, it means that I'm actually adding a value of null in place where I should be adding an object. In my eyes though, It seems that I AM adding an object in the ArrayList? I don't see the issue.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You define accessMod but never initialize it. So it is null and therefore you get a java.lang.NullPointerException when you try to use it.
 
Ben Jass
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haha, I appreciate it. Wow, I feel so dumb now, it was such an obvious mistake now that I look back at it. Ugh.
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Everybody has done that at one time or another.
 
Javin Paul
Ranch Hand
Posts: 297
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If you don't make mistake means you are not doing anything mistakes are good until they get repeated

welcome to javaranch

Cheers
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!