• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Really quick Java question.... about "super"

gopunk

Lifer
suppose i have a super class and a sub class, and they both have a function called "delete".

now suppose the delete method of the subclass calls super.delete so that it runs the delete method of the super class

if the superclass's delete function is recursive (it has a line that calls delete), will it call the delete of itself, or the delete of the subclass (this is what i'm hoping it does)?

thanks 🙂
 
Well first of all I'm assuming this is not an abstract class which is being extended by the subclass (obviously if you have code in the superclass method this isn't the case, but just checking)

EDIT: Alright I have no clue...

You could always try it.
 
Remember Java method invocation is always virtual (unless a method is marked final, in which case overriding would not apply).

That should answer your question. 😛
 
ok i just tested it, and indeed, it calls the subclasses one 🙂

i don't see why this is necessarily bad design...

anyways, thanks guys 🙂
 
Back
Top