interface D {}
class C {}
class B extends C {}
public class A extends B implements D{ public static void main(String[] args) throws Exception { C c = new A(); D d = (D)c; } } 请问D和C什么关系? (D)c这个操作是向上转型?还是向下转型? 什么是转型?? 转型是怎么实现的? ① short a =0 ; int i = a; a = (short)i;
② A a = new A(); C c = a; A a1 = (A)c; 以上两者有什么区别?
|