Re: java.lang.StackOverflowError
From: Brad BARCLAY (bbarclay_at_jsyncmanager.org)
Date: 10/27/03
- Previous message: Asad Khan: "java.lang.StackOverflowError"
- In reply to: Asad Khan: "java.lang.StackOverflowError"
- Next in thread: bm: "Re: java.lang.StackOverflowError"
- Reply: bm: "Re: java.lang.StackOverflowError"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Oct 2003 05:51:20 GMT
Asad Khan wrote:
> I have the following method inside I class,
>
> public boolean equals(Object o) {
> return (this.equals(o));
> }
>
> but when i call this method by "foo.equals(bum)" where foo and bum are some
> objects, I get a java.lang.StackOverflowError??
>
> I kinda know why its happening; I think it calls the same equals method and
> keep going round and round. But, this is what I have to do, without renaming
> the method, so what's the way around it?
You're getting this exception because you're recursing forever, with no
end. This is not correct.
Did you intend to call "super.equals(o)" instead?
Brad BARCLAY
-- =-=-=-=-=-=-=-=-= From the OS/2 WARP v4.5 Desktop of Brad BARCLAY. The jSyncManager Project: http://www.jsyncmanager.org
- Previous message: Asad Khan: "java.lang.StackOverflowError"
- In reply to: Asad Khan: "java.lang.StackOverflowError"
- Next in thread: bm: "Re: java.lang.StackOverflowError"
- Reply: bm: "Re: java.lang.StackOverflowError"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|