首页>题库>程序设计师-Java
1.管道是一种数据流形式,提供了不同程序之间直接传输数据的基本手段。
判断题2.下列类定义中()是合法的抽象类定义。
多选题A. abstractA{abstractvoidfun1();}~||~abstractclassA{abstractvoidfun1();}~||~abstractclassA{abstractvoidfun1(){};}~||~abstractclassA{voidfun1(){};}
3.有的类定义时可以不定义构造函数,所以构造函数不是必需的。
判断题4.下列()方法是Connection对象所具有的方法。
多选题A. executeUpdate()~||~createStatement()~||~preparedStatement()~||~PrepareCall()
5.下面程序段的运行的结果是()。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.
6.main()方法的返回类型是什么?
单选题A. int~||~void~||~boolean~||~static
7.如果下列的方法能够正常运行,在控制台上将显示()。publicvoidexample(){try{unsafe();System.out.println("Test1");}catch(SafeExceptione){System.out.println("Test2");}finally{System.out.println("Test3");}System.out.println("Test4");}
多选题A. Test1~||~Test2~||~Test3~||~Test4
8.Java变量中,以下不属于复合类型的数据类型是()。
单选题A. 类~||~字符型~||~数组型~||~接口
9.对于JavaBean的属性,下面()说法是正确的。
多选题A. JavaBean的属性可以在开发工具中设置~||~JavaBean可以提供public类型的属性~||~如果需要访问和修改JavaBean的属性,只能通过get/set方法~||~如果一个属性只提供了get方法,那么它是只读的
10.运行下列程序的结果是()。abstractclassMineBase{abstractvoidamethod();staticinti;}publicclassMineextendsMineBase{publicstaticvoidmain(Stringargv[]){int[]ar=newint[5];for(i=;i〈ar.length;i++)System.out.println(ar[i]);}}
单选题A. 打印5个0。~||~编译出错,数组ar[]必须初始化。~||~编译出错,Mine应声明为abstract。~||~出现IndexOutOfBoundes的例外。
11.如果p是父类Parent的对象,而c是子类Child的对象,则语句p=c是正确的。
判断题12.JPanel组件的默认布局管理器是()
单选题A. GridLayout~||~CardLayout~||~BorderLayout~||~FlowLayout
13.关于以下程序代码的说明正确的是()。.classHasStatic{2.privatestaticintx=1;3.publicstaticvoidmain(Stringargs[]){4.HasStatichs1=newHasStatic();5.hs1.x++;6.HasStatichs2=newHasStatic();7.hs2.x++;8.hs1=newHasStatic();9.hs1.x++;1.HasStatic.x--;11.System.out.println(“x=”+x);12.}13.}
单选题A. 5行不能通过编译,因为引用了私有静态变量~||~10行不能通过编译,因为x是私有静态变量~||~程序通过编译,输出结果为:x=103~||~程序通过编译,输出结果为:x=102
14.为文件c、javaexamplefile.txt建立File对象file1可以采用()语句序列。
多选题A. Filefile1=newFile(“c、\java\example\file.txt”)~||~Stringpath=”c、javaexample”Filefile1=newFile(path,”oldfile.txt”)~||~Filedir1=newFile(“c、\java\example”)Filefile1=newFile(dir1,”oldfile.txt”)~||~Filefile1=newFile(“c、java\examplefile.txt”)
15.在JAVA中,能实现多重继承效果的方式是():
单选题A. 内部类~||~适配器~||~接口~||~同步
16.System.out.println("morethan1");4}5elseif((str!=null)&(str.length()<5)){
判断题17.给出下面的代码publicclassParent{publicintaddValue(inta,intb){ints;
多选题A. intaddValue(inta,intb){//dosomething...}~||~publicvoidaddValue(){//dosomething...}~||~publicintaddValue(inta){//dosomething...}~||~publicintaddValue(inta,intb)throwsException{//dosomething...}
18.有关对成员变量正确的说法是()。
多选题A. 实例方法既能对类变量操作也能对实例变量操作。~||~类方法只能对类变量进行操作~||~实例方法不能对类变量操作只能对实例变量操作~||~类方法只能对类变量操作不能对实例变量操作。
19.可以修饰类的修饰符有()。
多选题A. public~||~final~||~abstract~||~protected
20.JavaBeans是轻量级的构件,EJB是重量级的构件。
判断题
Copyright © 昊元综合学习与考试平台 保定昊元电气科技有限公司版权所有 2021,All Rights Reserved
经营许可证编号: 冀B2-20210069号 备案号: 冀ICP备19021638号