- public class Person
- {
- private String name="Person";
- int age=0;
- }
- public class Child extends Person
- {
- public String grade;
- public static void main(String[] args){
- Person p = new Child();
- System.out.println(p.name);
- }
- }
复制代码
以上代码运行输出是( )
A) 输出:Person
B) 没有输出
C) 编译出错
D) 运行出错
|
|