comparing an object with null
From: Asad Khan (uoft_cstutor_at_yahoo.com)
Date: 10/31/03
- Previous message: Rick: "AWT or SWING?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 16:20:47 GMT
I have the following method in a class 'foo'.
public boolean equals(Object o) {
if (!(o.equals(null))) {
// do some stuff
}
}
The problem I am having is that, if the object that is passed in is
instanceof foo, then it recursively calls the equals method, and I get a
nullpointer exception. So how can I compare if the object that is being
passed in is null or not?
Thanks.
- Previous message: Rick: "AWT or SWING?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|