• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Error

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes? Is this an advanced topic or am I missing something here?
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic