java期末考试题

2026/4/29 2:13:37

}

classs Dec{

public void decrement(int decMe){

decMe = decMe - 1;

}

}

2、以下程序的输出结果为 。(结果为: Boy)

public class Short{

public static void main(String args[ ]) {

StringBuffer s = new StringBuffer(“Boy”);

if((s.length( )<3)&& (s.append(“男孩”) . equals(“False”)))

;

“结果为: ”+s);

}

}

3、以下程序段的输出结果为 。(Message four)

int x=0,y=4, z=5;

if ( x>2){

if (y<5){

“Message one”);

}

else {

“Message two”);

}

}

else if(z>5){

“Message three”);

}

else {

“Message four”);

}

4、以下程序段的输出结果为 。(two.three.)

int j=2;

switch ( j ) {

case 2:

“two.”);

case 2+1 :

“three.”);

break;

default:

“value is “+j);

break;

}

5、以下程序段的输出结果为 。class Cruncher{

void crunch( int i ){

“int”);

}

(int)

void crunch(String s){

“String”);

}

public static void main(String args[ ]){

Cruncher crun=new Cruncher ( );

char ch=’p’;

crun.crunch(ch);

}

}

6、阅读以下程序,写出输出结果 。(99)

class Q6{

public static void main(String args[ ]){

Holder h=new Holder( );

h.held=100;

h.bump(h);

}


java期末考试题.doc 将本文的Word文档下载到电脑
搜索更多关于: java期末考试题 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

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