首页>题库>程序设计师-Java
1.关于选择结构下列()说法是正确的。
单选题A. if语句和else语句必须成对出现~||~if语句可以没有else语句对应~||~switch结构中每个case语句中必须用break语句~||~switch结构中必须有default语句
2.当Frame改变大小时,放在其中的按钮大小不变,则使用如下()layout。
单选题A. GridLayout~||~CardLayout~||~EastandWestofBorderLayout~||~FlowLayout
3.下列代码段允许按钮注册一个action事件的是()。
单选题A. button.enableActionEvents();~||~button.addActionListener(anActionListener);~||~button.enableEvents(true);~||~button.enableEvents(AWTEvent.ACTION_EVENT_MASK);
4.在声明线程的run方法时,必须使用的限定词是()。
单选题A. public~||~private~||~protected~||~static
5.流在刚被创建时,指针位于()。
单选题A. 流的最后一个字节~||~流的第一个字节~||~上次离开的位置~||~随机位置
6.给出下面的代码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
7.和类相比,接口中的所有方法都没有被实现,类必须实现接口中的每个方法。
判断题8.下列程序存在的错误有()。finalclassFirst{privateinta=1;intb=2;}classSecondextendsFirst{publicvoidmethod(){System.out.println(a+b);}}
多选题A. println()参数应为字符串,因此此处不能调用该方法。~||~因为变量a是private,所以在其他类中不能到访问a。~||~Second不能继承First。~||~关键字final不能修饰类。
9.下面程序段的运行的结果是()。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.
10.一个表由()部分组成。
多选题A. 数据库~||~连接程序~||~表结构~||~表记录
11.Applet执行()方法后,进入运行态。
单选题A. start()~||~init()~||~stop()~||~destroy()
12.下面程序段()行有错误。、abstractclassEmployee{2、intbasic=2;3、abstractvoidsalary();4、}5、classManagerextendsEmployee{6、Employeeemp=newEmployee();7、voidsalary(){8、System.out.println(“工资等于”+basic*5+5678);9、}1、}
单选题A. 3行~||~6行~||~7行~||~8行
13.给出下面的类publicclassSample{longlength;publicSample(longl){length=l;}publicstaticvoidmain(Stringarg[]){Samples1,s2,s3;s1=newSample(21L);s2=newSample(21L);s3=s2;longm=21L;}}哪个表达式返回true?
单选题A. s1==s2;~||~s2==s3;~||~m==s1;~||~s1.equals(m);
14.enumerate方法只将活动的线程(即已经启动的线程)放进数组。
判断题15.Java程序是由若干类定义组成的,类定义包括定义类头和类体。
判断题16.Jbuilder9版中默认的布局管理器是()。
单选题A. GridLayout~||~BorderLayout~||~CardLayout~||~FlowLayout
17.System.out.println("lessthan5");7}8else{System.out.println("end");}哪些行将导致错误?
单选题A. 第1行~||~第2行~||~第5行~||~第8行
18.下面有关main()方法声明时,可以改动的是()。
单选题A. public~||~static~||~void~||~args
19.类与对象的关系是()。
多选题A. 类是对象集合的再抽象。~||~类(Class)是具有相同属性和行为的一组对象的集合。~||~一个对象称作类的一个实例。~||~类与对象是父与子的关系。
20.下面()注释方法能够支持javadoc命令。
单选题A. /**...**/~||~/*...*/~||~//~||~/**...*/
Copyright © 昊元综合学习与考试平台 保定昊元电气科技有限公司版权所有 2021,All Rights Reserved
经营许可证编号: 冀B2-20210069号 备案号: 冀ICP备19021638号