注意:此页面搜索的是所有试题
题目内容
(石家庄铁道大学面向对象程序设计)
读程序,写结果( )
public class AddTest{
public static void main(String args[]){
int t;
Value2 no=new Value2(10,20);
t=no.x+no.y;
System.out.println(“add=”+t);
}
}
class Value1{
int x,y;
Value1(int a, int b){
x=a+10;
y=b;
}
}
class Value2 extends Value1{
Value2(int a, int b){
super(a,b);
}
}
public class AddTest{
public static void main(String args[]){
int t;
Value2 no=new Value2(10,20);
t=no.x+no.y;
System.out.println(“add=”+t);
}
}
class Value1{
int x,y;
Value1(int a, int b){
x=a+10;
y=b;
}
}
class Value2 extends Value1{
Value2(int a, int b){
super(a,b);
}
}
参考答案