2025年Java选择题集锦大全.pdfVIP

  • 0
  • 0
  • 约3.43万字
  • 约 24页
  • 2026-03-13 发布于河北
  • 举报

《Java程序设计》理论题库一选择题(单项选择175题)

1.欲构造ArrayList类的一种实例,此类继承了List接,下列哪个措施是对的的?B

A、ArrayListmyList=newObject();

B、ListmyList=newArrayList();

C、ArrayListmyList=newList();

D、ListmyList=newList();

2.aint()措施使用哪种类型的参数?A

A、Grahics

B、Grahics2D

C、String

D、Color

3.指出对的的体现式D

A、byte=128;//byte取值到127

B、Boolean=null;

C、longl=0xfffL;

D、double=0.9239d;

4.指出下列程序运行的成果B

ublicclassExamle{

Stringstr-newString(good);

char[]ch={a,b,c};

ublicstaticvoidmain(Stringargs[]){

Examleex=newExamle();

ex.change(ex.str,ex.ch):

System,out.rint(ex.str+*and*);

Sytem.out.rint(ex.ch):

)

ublicvoidchange(Stringstr,charch[]){

str=testok”;

ch[0]=*g;

)

)

A、goodandabc

B、goodandgbc

C、testokandabc

D、testokandgbc

5.运行下列程序,会产生什么成果CD

ublicclassXextendsThreadimlementsRunable{

ublicvoidrun(){

System,out.rintin(*thisisrun()*);

}

ublicstaticvoidmain(Stringargs[])

Threadt=newThread(newXO);

t.start();

)

)

A、第一行会产生编译错误

B、第六行会产生编译错误

C、第六行会产生运行错误

D、程序会运行和启动

6.要从文献”文献中读出第10个字节到变量C中,下列哪个措施适合?A

A、in=newA);in.ski(9);intc=in.readO;

B、in=new(**);in.ski(10);intc=in.readO;

C、in=new「);intc=in.readO;

D、RandomAccessRandomAccessFileC*);in.ski(9);intc=in.readByteO;

7.容器被重新设置大小后,哪种布局管理器的容器中的组件大小不随容海大小的变化而变化?B

A、CardLayout

B、FlowLayout

C、BorderLayout

D、GridLayout

8.给出下面代码:

ublicclassPerson{

staticintear[]=newint[10];

ublicstaticvoidmain(Stringa[])

(

System,out.rintln(arr[l]);

)

)

那个语句是对的的?C

A、编译时将产生错误;

B、编译时对的,运行时将产生错误;

C、输出零;

D、输出空。

9.哪个关键字可以对对象加互斥锁?B

A、transient

Bsynch

文档评论(0)

1亿VIP精品文档

相关文档