Hi,
I am trying to compile this program and was expecting a compilation error, but it did not give.
class BaseClass
{
public void aMethod()
{
System.out.println("I am a BaseClass method");
}
}
public class Cals extends BaseClass
{
public void aMethod()
{
System.out.println("I am a SubClass method");
super.aMethod();
}
public static void main(
String [] arg)
{
Cals sc = new Cals();
sc.aMethod();
}
}
I was under the impression that the super.aMethod() is called after System.out.println() statement so it will give an error. Can anybody please explain why this is happening?
Thanks,
Subba Rao