-->
当前位置:首页 > 题库 > 正文内容

填空题:请说出A类中System.out.println的输出结果。

Luz3年前 (2021-05-10)题库3197
请说出A类中System.out.println的输出结果。
```
class B{
int x=100,y=200;
public void setX(int x){ x=x; }
public void setY(int y){ this.y=y; }
public int getXYSum(){ return x+y; }
}
public class A {
public static void main(String args[]){
B b=newB();
b.setX(-100);
b.setY(-200);
System.out.println("sum="+b.getXYSum());
}
}

```
程序输出结果为:sum=@@[-100](2)






答案:

第1空:-100 ,

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。