编辑: 戴静菡 2019-07-16
招聘试题6 1.

填空题(6′*5)

1、 JDK下解释执行Java的程序是?

2、类的声明 public class Test extends Applet implements Runable{} 中,定义的类名是?其父类是?实现了?接口.这个类的源程序必须保存为?写出包括扩展名的文件名).

3、一个完整的Java应用程序由一个或多个类组成;

其中Java Application至少有一个主类,这个类中包含一个名为?的方法.

4、要嵌入在HTML文件中运行的程序是?Java Application、 Java Applet).

5、运行下列程序段后,结果c的取值为? int a = 100, b = 20, c;

char oper ='

+'

;

switch(oper) { case '

+'

: ? c = a+b;

? break;

case '

-'

: ? c = a - b;

? break;

default : ? c = a * b;

? break;

} 2.选择题(4′*10) (1) 属于访问控制的关键字是(??? ). A、static?? B、final??? C、abstract??? D、private (2) 对成员的访问控制保护最强的是(??? ). A、public 、B、缺省、 C? private?? D protected (3) 可用做Java标识符的是(??? ).(多选) A. $persons B. TwoUsers C. *point D. this E. _endline (4) 缺省的存局管理器是(??? ). A、BorderLayout? B、FlowLayout? C、GridLayout?? D、CardLayout (5) 下面哪个不是java关键字(??? ).(多选) A. TRUE B. sizeof C. const D. super E. void (6) class Parent{ public void method1(){ //change here System.out.println( Parent'

s method1() );

} public void method2() { System.out.println( Parent'

s method2() );

method1();

} } class Child extends Parent{ public void method1(){ System.out.println( Child'

s method1() );

} public static void main(String args[]){ Child p = new Child();

p.method2();

} } 选项: A、 Compile time error B、Run time error C、prints : Parent'

s method2() Parent'

s method1() D、prints : Parent'

s method2() Child'

s method1() (7) How can you force garbage collection of an object? A. Garbage collection cannot be forced B. Call System.gc(). C. Call System.gc(), passing in a reference to the object to be garbage collected. D. Call Runtime.gc(). E. Set all references to the object to new values(null, for example). (8) 下面哪个不是Java中的容器? A、 ScrollPane B、Scrollbar C、Applet D、Dialog (9) 以下哪个方法用于定义线程的执行体?? ?A、?start() ?B、init() ?C、run() ?D、main() ?E、synchronized()? (10) The following is a program 1) class Exsuper{ 2) String name;

3) String nick_name;

4) 5) public ExSuper(String s,String t){ 6) name = s;

7) nick_name = t;

8) } 9) 10) public string toString(){ 11) return name;

12) } 13) } 14) 15) public class Example extends ExSuper{ 16) 17) public Example(String s,String t){ 18) super(s,t);

19) } 20) 21) public String toString(){ 22) return name + a.k.a +nick_name;

23) } 24) 25) public static void main(String args[]){ 26) ExSuper a = new ExSuper( First , 1st );

27) ExSuper b = new Example( Second , 2nd );

28) 29) System.out.println( a is +a.toString());

30) System.out.println( b is +b.toString());

31) } 32) } What happens when the user attempts to compile and run this program? A、 A Compiler error occurs at line

21 B、 An object of type ClassCastException is thrown at line

27 C、The following output: a is First b is second D、The following output: a is First b is Second a.k.a 2nd F、he following output: a is First a.k.a 1st b is Second a.k.a 2nd 3.编程题(15′*2) 编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串.但是要保证汉字不被截半个,如 我ABC 4,应该截为 我AB ,输入 我ABC汉DEF ,6,应该输出为 我ABC 而不是 我ABC+汉的半个 .

下载(注:源文件不在本站服务器,都将跳转到源网站下载)
备用下载
发帖评论
相关话题
发布一个新话题