Hi, folks !
from javacaps
class MyTest {
public void myTest() {
System.out.println("Printing myTest in MyTest class");
}
public static void myStat() {
System.out.println("Printing myStat in MyTest class");
}
}
public class
Test extends MyTest {
public void myTest() {
System.out.println("Printing myTest in Test class");
}
public static void myStat() {
System.out.println("Printing myStat in Test class");
}
public static void main (
String args[] ) {
MyTest mt = new Test();
mt.myTest();
mt.myStat();
}
}
C) Printing myTest in MyTest class followed by Printing myStat in MyTest class
I undestand perfect how de runtime choose the method , but I wnat to undestand the process when the method is static.
Why didn't choose the static version in Test if "this " reference is Test ? Why choose from MyTest ?
Thnaks in advance