感冒了的程序.输不出结果--why
package test;
class A{
int c=1;
void text(){System.out.println("A");}
}
class B extends A{
public B(){c=2;}
void text(){System.out.println("B");}
}
public class ExtendsText {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成方法存根
A a;
B b;
a =new A();
b=(B)a;//--------------------------------------------->这句有问题吗?输不出结果!
a.text();
b.text();
System.out.println(b.c);
System.out.println(a.c);
}
}