首页>题库>程序设计师-Java

程序设计师-Ja315道题

1.下列组件()是Swing窗口容器。

多选题

A. ContentPane~||~JApplet~||~Jdialog~||~Jpanel

2.System类在()包中。

单选题

A. java.util~||~java.io~||~java.awt~||~java.lang

3.下面()不是JavaBean的特征。

单选题

A. 内省~||~定制~||~持续~||~远程调用

4.Java程序中最小的可编译的单元为()。

单选题

A. 对象~||~类~||~方法~||~语句

5.如果一个程序段中有多个catch,程序会()。

单选题

A. 每个catch都执行一次~||~把每个符合条件的catch都执行一次~||~找到合适的例外类型后就不再执行其他catch~||~找到合适的例外类型后继续执行后面的catch

6.已知如下说明:TextAreata=newTextArea("Hello",5,5),请问()语句是正确的。

多选题

A. Themaximumnumberofcharactersinalineis5.~||~Thedisplayedheightis5linesotherwiseconstrain.~||~Thedisplayedstringcanusemultiplefonts.~||~Thedisplayedstringsareeditable.

7.如果局部变量的名字与成员变量的名字相同,则成员变量被隐藏。这时如果想在该方法内使用成员变量,必须使用关键字是()。

单选题

A. this~||~final~||~native~||~super

8.给出下面的代码publicvoidtest(){try{oneMethod();System.out.println("condition1");}catch(ArrayIndexOutOfBoundsExceptione){System.out.println("condition2");}catch(Exceptione){System.out.println("condition3");}finally{System.out.println("finally");}}在oneMethod()方法运行正常的情况下将显示什么?

多选题

A. condition1~||~condition2~||~condition3~||~finally

9.以下()语句是将Applet嵌入到HTML文档中。

单选题

A. 〈APPLETCODE=”applet程序名.class”〉~||~〈APPLET=”applet程序名.class”〉~||~〈APPLETCODE=”applet程序名.java”〉~||~〈APPLET=”applet程序名.java”〉

10.运行下列程序,会产生()结果。classOuter1{privateinta;voidfoo(doubled,finalfloatf){Strings;finalbooleanb;classInner{voidmethodInner(){System.out.println("intheInner");}}}publicstaticvoidmain(Stringargs[]){Outer1me=newOuter1();me.foo(123,123);System.out.println("outer");} }

单选题

A. intheInnerouter~||~outer~||~intheInner~||~编译不通过

11.当运行javac命令对一个java源程序进行编译时,必须写出该源程序文件的完整文件名,包括扩展名.java。

判断题

12.java中定义数组名为abc,下面()可以得到数组元素的个数。

单选题

A. abc.length()~||~abc.length~||~len(abc)~||~ubound(abc)

13.下面程序段的运行的结果是()。classExample{publicstaticvoidmain(String[]args){Stringstr1=newString(“abc”);Stringstr2=newString(“abc”);if(str1.equals(str2))System.out.println(“Twostringsareequal.”);elseSystem.out.println(“Twostringsarenotequal.”);if(str1==str2)System.out.println(“str1==str2istrue.”);elseSystem.out.println(“str1==str2isfalse.”);}}

单选题

A. Twostringsareequal.str1==str2isfalse.~||~Twostringsarenotequal.str1==str2isfalse.~||~Twostringsareequal.str1==str2istrue.~||~Twostringsarenotequal.str1==str2istrue.

14.JDK提供的用于并发编程的同步器有哪些?

多选题

A. Semaphore~||~CyclicBarrier~||~CountDownLatch~||~Counter

15.下面()语句能够正确地生成空字符串。

多选题

A. Stringa[]=newString[5];for(inti=0;i〈5;a[++]="");~||~Stringa[5];~||~String[5]a;~||~Stringa[]={"","","","",""};

16.上转型对象具有如下()特点。

多选题

A. 上转型对象不能操作子类新增的成员变量(相当于失掉了这部分属性)、不能使用子类新增的方法(相当于失掉了一些功能)。~||~上转型对象可以操作子类继承或覆盖的成员变量,也可以使用子类继承的或覆盖的方法。~||~如果子类覆盖了父类的某个方法后,当对象的上转型对象调用这个方法时一定是调用了这个覆盖的方法,因为程序在运行时知道,这个上转型对象的实体是子类创建的,只不过损失了一些属性和功能而已。~||~可以将父类创建的对象的引用赋值给子类声明的对象。

17.下列()语句是关闭数据连接时使用的语句。

单选题

A. StatementSQL语句变量=连接变量.createStatement()~||~Connection连接变量=DriverManager.getConnection(数据库URL,用户帐号,用户密码)~||~Class.forName(JDBC驱动程序名)~||~连接变量.close()

18.下面的哪些程序片断可能导致错误。

多选题

A. Strings="Gonewiththewind";~||~Strings="Gonewiththewind";~||~Strings="Gonewiththewind";~||~Strings="homedirectory";

19.下面()事件监听器在Java中有事件适配器。

多选题

A. MouseListener~||~KeyListener~||~ActionListener~||~ItemListener

20.Java语言中的数组元素下标总是从开始,下标可以是整数或整型表达式。

判断题
注册后查看全部试题

保定市乐凯大街305号

电话: 400-608-5357

邮编: 100043


Copyright © 昊元综合学习与考试平台 保定昊元电气科技有限公司版权所有 2021,All Rights Reserved

经营许可证编号:  冀B2-20210069号       备案号:    冀ICP备19021638号