File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Error" Watch "Java Error" New topic

Java Error

Chandra Moulee

Joined: Sep 26, 2005
Posts: 16
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.


Tom Billings

Joined: Sep 12, 2005
Posts: 16
Yes? Is this an advanced topic or am I missing something here?
Stuart Gray
Ranch Hand

Joined: Apr 21, 2005
Posts: 410
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

Joined: Jul 08, 2003
Posts: 24199

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.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Java Error
It's not a secret anymore!