Originally posted by Henry Wong:
BTW, I am surprised that the compiler didn't complain that you are using an instance to call a static method.
If a subclass has a constructor, when that subclass is instatiated with, does the compiler call the constructor of the superclass too?
If a subclass has a constructor
Question30Super q31 = new Question30Super();
Question30Super q30 = new Question30();
Base B1 = new Sub();
Sub B2 = new Sub();
What is the difference when I call methods from B1 and B2? Does it only affect when calling static methods?
If I override a method in Sub, can I call that method from B1?
If I have a method in Sub, which is not defined in Base, can I call that method from B1?
If I override a static method in Sub, can I call that static method from B1? or is it only from B2 that I can call it?