1.  >>  国开 / 面向对象程序设计
 国开 / 面向对象程序设计

public class XXK2 {

private final int a;

public XXK2(int a) {this.a=a;}

public int f1(int x) {

if(x%2==1) return 2*(a+x);

else return 3*a+x;

}

public int get() {return a;}

public static void main(String[] args) {

XXK2 x=new XXK2(8);

int y=x.f1(20);

y+=x.get();

System.out.println("y="+y);

}

}
y =52
y =62
 参考答案:
 佳题速递: