您好,提问者:
这个基本能想到的有两种,如下代码:
public class Student{private int a
private int b
private int c
public Student(int a, int b, int c){
this.a = a
this.b = b
this.c = c
}
} class Person{
private int a
private int b
private int c
public Person(int a, int b, int c){
this.a = a
this.b = b
this.c = c
}
}
public class Student{
public Student(int a, int b, int c){
super(a,b,c)
}
}
刚重测了一下.确实是这样.下面是给出的答案.绝对正确.我现在也搞懂这个问题了...因为在java中一个对象做为参数传递给另一个方法使用.传的是对象的引用,而传送的不是另一个新的对象.所以他的修改要影响前面的对象