• Post Reply Bookmark Topic Watch Topic
  • New Topic

the two classes compile without errors but when i try to run them they throw exceptions  RSS feed

 
fady zohdy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
numHitslocs
this is my first post so forgive me for any posting mistakes



 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fady zohdy wrote:this is my first post so forgive me for any posting mistakes

Hi Fadi: No problemo; and welcome to JavaRanch!

It would be great if you could tell us what Exception you're getting, rather than us having to hunt for it.
Best is probably just to cut and paste the first few lines of the exact stacktrace you get and post them.

Winston
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

What sort of Exception are you suffering?
You did something wrong with the code tags: please look at this link. Never mind: I have corrected that tags
 
fady zohdy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you so much for your replies and thanks for correcting the tags campbell

here are the exceptions:
Exception in thread "main" java.lang.NullPointerException
at simpleDotCom.checkGuess(simpleDotCom.java:14)
at launchGame.main(launchGame.java:9)
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a close look at line 6.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only object which might be null on line 14 is locationCells, the array; cell is an int which is chosen from locationCells, so that cannot be null
 
fady zohdy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks. got it working.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome

For the help of future readers, please explain why your solution worked.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!