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

程序设计师-Ja315道题

1.break语句可直接跳出外层循环。

判断题

2.main()方法的返回类型是什么?

单选题

A. int~||~void~||~boolean~||~static

3.下列()说法是正确的。

多选题

A. IOException必须被捕获或抛出~||~java语言会自动初始化变量的值~||~java语言不允许同时继承一个类并实现一个接口~||~java语言会自动回收内存中的垃圾

4.是否可以继承String类?为什么?()

多选题

A. 是~||~否~||~String类是final类故不可以继承。~||~String类是abstract类故可以继承。

5.在JAVA编程中,Java编译器会将java程序转换为()。

单选题

A. 字节码~||~可执行代码~||~机器代码~||~以上所有选项都不正确

6.下面()描述是正确的。

单选题

A. Applet程序中不需要main()方法,也不能有~||~Application程序中可以没有main()方法。~||~Applet程序中可以不定义init()方法~||~Application程序中必须有run()方法

7.下面程序段的运行的结果是()。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.

8.运行下列程序,会产生()结果。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~||~编译不通过

9.Statement对象使用executeQuery()方法仅返回的是()。

单选题

A. 多个ResultSet~||~一个ResultSet~||~多个Connection~||~一个Connection

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

单选题

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

11.Applet执行()方法后,进入运行态。

单选题

A. start()~||~init()~||~stop()~||~destroy()

12.Java与C/C++相比正确的叙述是()。

单选题

A. 在Java中无指针,没有指针的程序无法访问不属于它的内存,提高了程序的安全性。~||~Java与C/C++一样支持多重继承。~||~在Java中,所有的数据结构都是对象,通过new来分配内存,free来释放内存。~||~Java支持多继承

13.classParent{2)privateStringname;3)publicParent(){}4)}5)publicclassChildextendsParent{6)privateStringdepartment;7)publicChild(){}8)publicStringgetValue(){returnname;}9)publicvoidmain(Stringarg[]){1)Parentp=newParent();11)}12)}()行将引起错误。

单选题

A. 第3行~||~第6行~||~第8行~||~第9行

14.要想建立一个学生成绩表student,以下()SQL语句是正确的。

单选题

A. createtablestudent~||~createtablestudent(学号char(10),姓名char(8))~||~creategridstudent~||~creategridstudent(学号char(10),姓名char(8))

15.使用JavaBean的好处有()。

多选题

A. JavaBean拥有标准化接口的优点,在开发期有可视化编程工具的支持,在运行期有JSP和J2EE连接器的支持。~||~JavaBean更明确的把WEB页面的设计和软件的设计区分开来。~||~JavaBean可以在多个应用程序中重用~||~JavaBean可以实现安全性、事务行为、并发性和持久性。

16.对对象的理解正确的是()。

多选题

A. 对象由属性和行为两部分组成。~||~对象可以是一个人、地址、物品、事件、概念等。~||~万事万物皆可看做对象。~||~对象=数据十作用于这些数据上的操作

17.下面()是java语言中的关键字。

单选题

A. sizeof~||~abstract~||~NULL~||~Native

18.给出下面代码段1)publicclassTest{2)intm,n;3)publicTest(){}4)publicest(inta){m=a;}5)publicstaticvoidmain(Stringarg[]){6)Testt1,t2;7)intj,k;8)j=;k=;9)t1=newTest();1)t2=newTest(j,k);11)}12)}()将引起一个编译时错误。

单选题

A. line3~||~line5~||~line6~||~line10

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

单选题

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

20.Javaapplication中的主类需包含main方法,main方法的返回类型是()。

单选题

A. int~||~float~||~double~||~void

注册后查看全部试题

保定市乐凯大街305号

电话: 400-608-5357

邮编: 100043


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

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