Search code examples
javaoverridingextend

Java extending and overriding classes


I've got two classes:

class A{
    method(){}
}
class B extends A{
    @Override
    method(){
        super.method();
        //some logic
    }
}

and I have created third one:

class C extends B{
       @Override
       method(){
       super.method();
       //more logic
    }
}

but I am not sure whether "some logic" will be executed. Could someone tell if it is or not and maybe recommend me good tutorial about extending classes and overriading methods?


Solution

  • When you call the super () class of an extending method the extended (parent) method will surrly be called.

    Here's a good inheritance tutorial http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html