SunScreenCert
asked on
The output of this program is "High" "High". Plz explain?
package scjp;
public class A {
private String runNow(){
return "High";
}
static class B extends A{
public String runNow(){
return "Low";
}
}
public static void main(String[] args) {
A a[] = new B[]{new B(), new C()};
for(A aa: a){
System.out.println(aa.runN ow() + " ");
}
}
}
class C extends A.B{
public String runNow(){
return "Out";
}
}
public class A {
private String runNow(){
return "High";
}
static class B extends A{
public String runNow(){
return "Low";
}
}
public static void main(String[] args) {
A a[] = new B[]{new B(), new C()};
for(A aa: a){
System.out.println(aa.runN
}
}
}
class C extends A.B{
public String runNow(){
return "Out";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER