《Java面向对象程序设计》考试卷及答案带注释(2)

2018-12-29 22:51

int y,x=1,total=0; while(x<=3){ y=x*x;

System.out.println(y); total+=y; ++x; }

System.out.println(\ }

}

3.下列程序段的运行结果为_____10.0_________。

class Q1{

public static void main(String args[ ]){ double d=10;

Dec dec=new Dec( ); dec.decrement(d); System.out.println(d); } }

class Dec{

public void decrement(double decMe){ decMe = decMe -5;

}

}

4.下列程序段的运行结果为______________。 public class abc{

public static void main(String args[ ]){

SubSubClass x = new SubSubClass(10 , 20 , 30);

x.show(); } }

class SuperClass{

int a,b;

SuperClass(int aa , int bb){

a=aa; b=bb; }

void show( ) {

System.out.println(\ }

}

class SubClass extends SuperClass{

int c;

SubClass(int aa,int bb,int cc){

super(aa,bb); c=cc;

} }

class SubSubClass extends SubClass {

int a;

SubSubClass(int aa,int bb,int cc) {

super(aa,bb,cc); a=aa+bb+cc;

}

void show(){

System.out.println(\ }

}

5.下列程序段的运行结果为____234__________。

第6页 共3页

public class Test{

public static void foo(int i){ try{

if(i==1){

throw new Exception(); }

System.out.print(\ }catch(Exception e){

System.out.print(\ }finally{

System.out.print(\ }

System.out.print(\ }

public static void main(String[] args){ foo(1); }

}

图2

第7页 共3页


《Java面向对象程序设计》考试卷及答案带注释(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:汽车电子控制技术教案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: