lets research following code:
public class App {
public static class A {
public void doSmth3(long a) {
System.out.println("This is doSmth3() in A...");
}
}
public static class B extends A {
public void doSmth3(int a) {
System.out.println("This is doSmth3() in B...");
}
}
public static void test(A a) {
a.doSmth3(1);
}
public static void main(String[] args) {
test(new B());
new B().doSmth3(3);
}
}
ouput:
This is doSmth3() in A...
This is doSmth3() in B...
from my side 2 lines in main should provide same result but result is different.
My opininion This is doSmth3() in A... should output twise because it is overloading.
Please explain output