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=new B(); b.setX(-100); b.setY(-200);System.out.println(“sum=”+b.getXYSum());}}
添加回答
举报
0/150
提交
取消