Let's say we have some class structure:     public interface IA { public void doA(); }     public class A implements IA { public void doA(){ System.out.println(A class doA);}     public class B extends A { public void doA(){ System.out.println(B class doA); }And now in a main I state this:     //in a main     IA ia = new B();     ia.doA();Am I correct in stating that the the runtime object of ia is a B class and it has inherited all the super classes methods and attributes?The printout from within the imaginary main is B class doA as the method doA in B will hide the same methods in its super classes?
How can I explain the A a = new B();?
java
Yes, you are correct.ia is of class Bia is also of class A since B inherits A.B overrrides A's doA() method.