I have the following method in a class 'foo'.
public boolean equals(Object o) {
if (!(o.equals(nul l))) {
// 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.
public boolean equals(Object o) {
if (!(o.equals(nul l))) {
// 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.
Comment