77范文网 - 专业文章范例文档资料分享平台

面向对象程序JAVA程序设计复习题,练习题有答案0(3)

来源:网络收集 时间:2020-03-26 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

byte bytes[]={0,1,2,3,4,5,6,7,8,9}; stringbuffer sb=new stringbuffer(s3); string s5=new string(sb);

system.out.println(\ system.out.println(\ system.out.println(\ system.out.println(\ system.out.println(\ } }

A. the string no.1 is

the string no.2 is string 2 the string no.3 is a string the string no.4 is string the string no.5 is a string B. the string no.1 is

the string no.2 is string 2 the string no.3 is a string the string no.4 is tring the string no.5 is a string C. the string no.1 is

the string no.2 is string 2 the string no.3 is a string the string no.4 is strin the string no.5 is a string D. 以上都不对

71.下面语句段的输出结果是( )。 int i = 9; switch (i) { default:

system.out.println(\ case 0:

system.out.println(\ break; case 1:

system.out.println(\ case 2:

system.out.println(\

A. default C error default clause not defined 72.监听器接口的方法返回值是( )。

A. int B.string C.void D.object

B default, zero

D no output displayed

11

73.给出如下代码: class test{

private int m;

public static void fun() { // some code... } }

可以使成员变量m 被方法fun()直接访问的手段是( )。

A.将private int m 改为protected int m B.将private int m 改为 public int m C.将private int m 改为 static int m B.将private int m 改为 int m

74.java中main()方法的参数的类型是( )。

A.String B.int C.char D.void

75.下面的代码段中,执行之后i 和j 的值是( )。 int i = 1; int j; j = i++;

A. 1, 1 B.1, 2 C.2, 1 D.2, 2

76.main()方法的合法参数是( )。

A.char args[] B.Char args[][] C.String[] arg D.int args[]

77.已知表达式int m[] = {0, 1, 2, 3, 4, 5, 6 }; 下列表达式的值与数组下标量总数相等的是( )。

A. m.length() B.m.length C.m.length()+1 D.m.length+1

78.main()方法的合法参数是( )。

A. Char args[] B.Char args[][] C.String a[] D.String args

79.已知如下代码: public class test {

long a[] = new long[10];

public static void main ( string arg[] ) { system.out.println ( a[6] ); } }

下列语句正确的是( )。 A.output is null B.output is 0

C.when compile, some error will occur D.when running, some error will occur

12

80.已知如下代码: boolean m = true; if ( m == false )

system.out.println(\else

system.out.println(\执行结果是( )。

A. false B.true

C.none D.an error will occur when running.

81.当frame改变大小时,放在其中的按钮大小不变,则使用的layout应该是( )。

A. flowlayout B.cardlayout C.north and south of borderlayout D.gridlayout

82.下列方法可以将menubar加入frame中的是( )。

A. setmenu() B.setmenubar() C.add() D.addmenubar()

83.在浏览器中执行applet 程序,将被最后执行的方法是( )。

A.init() B.start() C.destroy() D.stop()

84.关于被私有保护访问控制符private protected修饰的成员变量,以下说法正确的是( )

A. 可以被三种类所引用:该类自身、与它在同一个包中的其他类、在其他包中的

该类的子类

B. 可以被两种类访问和引用:该类本身、该类的所有子类 C. 只能被该类自身所访问和修改 D. 只能被同一个包中的类访问

85.以下代码段将创建( )个对象。 String s1=\ String s2=\

0 B.1 C.2 D.3

86.编译并运行以下程序,以下描述哪个选项是正确的( )

1) class X{

2) protected String toString(){ 3) return super.toString();} 4) }

A.编译通过运行无异常 B.编译通过但运行时出错 C.行2出错,不能成功编译 D.不能成功编译,行3出错

87.下列关于修饰符混用的说法,错误的是( )

A. abstract不能与final并列修饰同一个类 B. abstract类中不可以有private的成员 C. abstract方法必须在abstract类中 D. static方法中能处理非static的属性

88.容器Panel和Applet缺省使用的布局编辑策略是( ) A.BorderLayout B.FlowLayout C.GridLayout D.CardLayout

13

89.以下标识符中哪项是不合法的( )

A.BigMeaninglessName B.$int C.1 st D.$1

89.main方法是Java Application程序执行的入口点,关于main方法的方法头以下哪项是合法的( )

A. public static void main() B.public static void main(String[ ] args)

C. public static int main(String[ ] arg) D.public void main(String arg[ ])

90.执行完以下代码int [ ] x = new int[25];后,以下哪项说明是正确的( ) A.x[24]为0 B.x[24]未定义 C.x[25]为0 D.x[0]为空 91.以下代码段执行后的输出结果为( ) int x=3; int y=10; System.out.println(y%x);

A.0 B.1 C.2 D.3

92.以下哪个表达式是不合法的( )

A.String x=”Hello”; int y=9; x+=y;

B.String x=”Hello”; int y=9; if(x= =y) { } C.String x=”Hello”; int y=9; x=x+y;

D.String x=null; int y=(x!=null)&&(x.length()>0) ? x.length : 0

93.编译运行以下程序后,关于输出结果的说明正确的是 ( ) public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 99.9 :9));

} }

A.输出结果为:value is 99.99 B.输出结果为:value is 9 C.输出结果为:value is 9.0 D.编译错误 94.以下声明合法的是( )

A.default String s; B.public final static native int w( ) C.abstract double d; D.abstract final double hyperbolicCosine( ) 95.关于以下application的说明,正确的是( )

1) class StaticStuff 2) {

3) static int x=10; 4) static { x+=5;}

5) public static void main(String args[ ]) 6) {

7) System.out.println(“x=” + x); 8) }

9) static { x/=3;} 10) }

14

A. 4行与9行不能通过编译,因为缺少方法名和返回类型 B. 9行不能通过编译,因为只能有一个静态初始化器

C. 编译通过,执行结果为:x=5 D. 编译通过,执行结果为:x=3

96.关于以下程序代码的说明正确的是( )

1) class HasStatic{

2) private static int x=100;

3) public static void main(String args[ ]){ 4) HasStatic hs1=new HasStatic( ); 5) hs1.x++;

6) HasStatic hs2=new HasStatic( ); 7) hs2.x++;

8) hs1=new HasStatic( ); 9) hs1.x++; 10) HasStatic.x- -;

11) System.out.println(“x=”+x); 12) } 13) }

A. 5行不能通过编译,因为引用了私有静态变量 B. 10行不能通过编译,因为x是私有静态变量 C. 程序通过编译,输出结果为:x=103 D. 程序通过编译,输出结果为:x=102

97.以下选项中循环结构合法的是( ) A.while (int i<7)

{ i++;

System.out.println(“i is “+i); }

B.int j=3;

while(j)

{ System.out.println(“ j is “+j); }

C.int j=0;

for(int k=0; j + k !=10; j++,k++)

{ System.out.println(“ j is “+ j + “k is”+ k); }

D.int j=0;

do{ System.out.println( “j is “+j++); if (j = = 3) {continue loop;} }while (j<10); 98.类Test1定义如下:

1) public class Test1{ 2) public float aMethod(float a,float b){ 3)

15

}

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库面向对象程序JAVA程序设计复习题,练习题有答案0(3)在线全文阅读。

面向对象程序JAVA程序设计复习题,练习题有答案0(3).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/874619.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: