本帖最后由 kimi 于 2013-5-31 01:11 编辑
- class Person
- {
- public Person(){
- this.print();
- }
- public void print(){}
- }
- class Student extends Person
- {
- private int score=90;
- public Student(int score){
- this.score = score;
- }
- public void print(){
- System.out.println("score="+this.score);
- }
- }
- public class Test
- {
- public static void main(String[] args){
- Student stu = new Student(98);
- }
- }
复制代码 运行结果是0,这是为嘛啊 |