Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Error

 
Chandra Moulee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while(a[row][0].equals(record.getSelectedItem())); throw me an error when
a[row][0] is null.Exception occurred during event dispatching:java.lang.NullPointerException.

Regards

Chandramouli.V.N.
 
Tom Billings
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes? Is this an advanced topic or am I missing something here?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well NullPointerException means one of your references is null. If the equals method is called to compare to a null value it should return false, so my guess would be that your array contains a null object (or indeed, "a" itself is null).

Try printing out the value of a[row][0] to see if it is null.

Incidentally, this isn't really an advanced question, so don't be surprised if the sheriffs move this thread somewhere else.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandra --

Welcome to JavaRanch!

When you have a chance, please take a look at the "Asking good questions" link in my signature below -- in particular, there are sections about how to choose a forum for your post (carefully), how many forums you should post in (one), and choosing a meaningful subject line.

You've made seven posts at JavaRanch, in three different forums, over a few days; all of them concern this same problem. You started three different threads in this "Java in General (Advanced) forum alone, when this definitely isn't an advanced problem. If you had chosen an appropriate forum the first time (the Java Beginner's forum), and stuck with that one thread, then by now, you'd surely have had a meaningful conversation about this problem and learned how to solve it. But because you've been jumping all over the place, you just keep getting the same short answer over and over again.

I've closed all your other threads. Please don't start a new one for this problem. Instead, continue the discussion in this one until your problem is solved.

I'm moving this thread to "Java in General (Beginner)" -- please continue the conversation there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic