About Question com.enthuware.ets.scjp.v6.2.646 :
Posted: Sun Mar 27, 2011 3:26 pm
When I run this, I get "B is an A". Yet, your answer says this is wrong and the "B is like a A". I haven't heard this 'like a' expression used before. Please explain.
Code: Select all
public class B implements A {
int value1 = 10;
public static void main (String [] args) {
B b = new B();
if (b instanceof A){
System.out.println("B is an A");
}else{
System.out.println("B is not an A");
}
}
}