If I have
public class Base{
public void method(){
System.out.println("I am base");
}
}
public class Derived extends Base{
public void method(){
System.out.println("I am derived");
}
}
is there a difference between
Base b = new Derived();
and
Derived d = new Derived();
? And, would
b.method();
d.method();
print the same?