求指教,不太理解
Given the folowing classes which of the following will compile without error ?
interface IFace{}
class CFace implements IFace{}
class Base{}
public class ObRef extends Base{
public static void main(String argv[]){
ObRef ob = new ObRef();
Base b = new Base();
Object o1 = new Object();
IFace o2 = new CFace();
}
}
A. o1=o2;
B. b=ob;
C. ob=b;
D. o1=b;
解答:B
为什么选B