單項選擇題

class Dog { } 
class Harrier extends Dog { } 
class DogTest { 
public static void main(String [] args) { 
Dog d1 = new Dog(); 
Harrier h1 = new Harrier(); 
Dog d2 = h1; 
Harrier h2 = (Harrier) d2; 
Harrier h3 = d2; 
} 
} 
下面哪一項是正確的?() 

A.編譯失敗
B.2個Dog對象被創(chuàng)建
C.2個Harrier對象被創(chuàng)建
D.3個Harrier對象被創(chuàng)建

微信掃碼免費(fèi)搜題