正在加载图片...
得分 评卷人 四、写出下列每个程序编译和运行后的输出结果(每小题10分,共 50分) 41.public class XXK{ public static void main(String[]args){ int x,y=0; for(x=1;x<10;x++) if(x%2==0)y十=x*x; System.out.println("y="+y); 42.public class XXK2( private final int a; public XXK2(int a)(this.a=a;) public int fl(int x) if(x%2==1)return a++x; else return a-x; public static void main(String]args){ XXK2 x=new XXK2(3); int y=x.f1(10); System.out.printin("y="+y); 1567得分|评卷人 四、写出下列每个程序编译和运行后的输出结果{每小题 50 41. public class XXK { public static void main (Stri args) { int x , y=O; for(x=l; x<lO; x+ ifCx%2==0) y+=x 祷x; System. out. println(" y= "+ y) ; 42. public class XXK2 { private final int a; public XXK2(int a) {this. a=a;) public int f1 (int x) { if(x%2= =1) return a+x; else return a-x; public static void main(String[] args) { XXK2 x=new XXK2(3); in t y = x. f1 (l() ; System. out. println("y="+y); 1567
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有