德邦java面试题.doc

上传人:scccc 文档编号:12342573 上传时间:2021-12-03 格式:DOC 页数:14 大小:68.50KB
返回 下载 相关 举报
德邦java面试题.doc_第1页
第1页 / 共14页
德邦java面试题.doc_第2页
第2页 / 共14页
德邦java面试题.doc_第3页
第3页 / 共14页
德邦java面试题.doc_第4页
第4页 / 共14页
德邦java面试题.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《德邦java面试题.doc》由会员分享,可在线阅读,更多相关《德邦java面试题.doc(14页珍藏版)》请在三一文库上搜索。

1、德邦java面试题问题:德邦java面试题 回答:一、选择题(20)含多选。(请在正确的答案上打”"”)Question 1)Which of the followi ng stateme nts are true1) An in terface can on ly con tai n method and not variables2) In terfaces cannot have con structors3) A class may exte nd only one other class and impleme ntonly one in terface4) In terf

2、aces are the Java approach to address ing its lackof multiple inheritanee, but require implementing classes to create the fun cti on ality of the In terfaces.Questi on 2)Which of the followi ng stateme nts are true1) The garbage collecti on algorithm in Java is ven dor impleme nted2) The size of pri

3、mitives is platform depe ndent3) The default type for a numerical literal with decimal comp onent is a float.4) You can modify the value in an In sta nee of the In tegericlass with the setValue methodQuesti on 3)Which of the followi ng are true stateme nts1) I/O in Java can only be performed using t

4、he Listener classes2) The RandomAccessFileclass allows you to movedirectly to any point a file.3) The creation of a named instanee of the File class creates a matchi ng file in the un derly ing operati ng system only whe n the close method is called.4) The characteristics of an in sta nee of the Fil

5、e class such as the directory separator, depe nd on the curre nt un derly ing operati ng systemQuestion 4)What will happe n whe n you attempt to compile and runthe followi ng codeclass Basepublic void Base()System.out.pri ntln( Base );public class In exte nds Basepublic static void main( Stri ng arg

6、v)In i=new In ();1) Compile time error Base is a keyword2) Compilati on and no output at run time3) Output of Base4) Run time error Base has no valid con structorQuesti on 5)mai nYou have a public class called myclass with the method defi ned as followspublic static void main( Stri ng parm)System.ou

7、t.pri ntl n(parm0);If you attempt to compile the class and run the program as followsjava myclass helloWhat will happe n1) Compile time error, mai n is not correctly defi ned2) Run time error, mai n is not correctly defi ned3) Compilati on and output of java4) Compilati on and output of helloQuesti

8、on 6)Which of the followi ng stateme nts are NOT true1) If a class has any abstract methods it must be declared abstract itself.2) When applied to a class, the final modifier means it cannot be sub-classed3) All methods in an abstract class must be declared as abstract4) tran sie nt and volatile are

9、 Java modifiersQuesti on 7)What will happe n whe n you attempt to compile and runthe followi ng classclass BaseBase(i nt i)System.out.pri ntln( Base );class Sever n exte nds Basepublic static void main( Stri ng argv)Sever n s = new Sever n();void Sever n()System.out.pri ntln( Sever n );1) Compilati

10、on and output of the stri ng Sever n at run time2) Compilati on and no output at run time3) Compile time error4) Compilati on and output of the stri ng BaseQuesti on 8)Which of the followi ng stateme nts are true1) Static methods cannot be override n to be non static2) Static methods cannot be decla

11、red as private3) Private methods cannot be overloadednotbe4) An overloaded method cannot throw exceptions checked in the base classQuesti on 9)Which of the followi ng stateme nts are true1) The automatic garbage collecti on of the JVM preve nts programs from ever running outof memory2) A program can

12、 suggest that garbage collection performed but not force it3) Garbage collecti on is platform in depe ndent4) An object becomes eligible for garbage collecti on whe nall referen ces denoting it are set to n ull.Question 10)Give n the follow ing codepublic class Sytchint x=2000;public static void mai

13、n( Stri ng argv)System.out.pri ntl n( Ms +argv1+ Please pay $ +x);What will happe n if you attempt to compile and run thiscode with the comma nd linejava Sytch Jones Diggle1) Compilatio n and output of Ms Diggle Please pay $20002) Compile time error3) Compilatio n and output of Ms Jones Please pay $

14、20004) Compilati on but run time errorQuestion 11)You n eed to read in the lines of a large text file containingtens of megabytes of data. Which of the follow ing would bemost suitable for read ing in such a file1) new FileI nputStream( file. name )2) newIn putStreamReader( newFileI nputStream( file

15、. name )3) newBufferedReader( newIn putStreamReader( newFileI nputStream( file. name );4) newRan domAccessFileraf= newRan domAccessFile( myfile.txt , +rw );Question 12)Which of the followi ng stateme nts are true1) Con structors cannot have a visibility modifier2) Con structors are n ot in herited3)

16、 Con structors can on ly have a primitive return type4) Con structors can be marked public and protected, butnot privateQuestion 13)Which stateme nt is true1) A n anonym ous inner class may be declared as fin al.2) A n anonym ous inner class can be declared as private.3) An anonymous inner class can

17、 implementmultiplein terfaces .4) A n anonym ous inner class can access final variables inany en clos ing scope.5) Constructionof an instaneeof a static inner classrequires an in sta nee of the en clos ing outer class.Question 14)public class Foopublic static void mai n( Stri ng sgf)Stri ngBufer a =

18、 new Strin gBuffer( A );Stri ngBuffer b = new Stri ngBuffer( B ); operate(a,b);System.out.pri ntln (a+ , +b); static void operate(Stri ngBufer x,Stri ngBuffer y)x.appe nd(y);y=x; What is the result1) The code compiles and prints“A.B” .2) The code compiles and prints“A.A ” .3) The code compiles and p

19、rints“ B.B” .4) The code compiles and prints“ AB.B ”5) The code compiles and prints“ AB.ABQuestion 15)Which of the followi ng thread state tra nsiti ons are valid1) From ready to running.2) From running to ready.3) From running to wait ing.4) From wait ing to running.5) From wait ing to ready.6) Fro

20、m ready to wait ing.Question 16)What is the result of attempti ng to compile and run the followi ng programpublic class Test private int i = j;private int j = 10;public static void mai n( Stri ng args) System.out.pri ntln (new Test().i);1) Compiler error complai ning about access restrictio n of pri

21、vate variables of Test.2) Compiler error complai ning about forward referencing.3) No error - The output is 0;4) No error - The output is 10;Question 17)stopWhich two cannot directly cause a thread to executi ng1) exit ing from a synchroni zed block2) calli ng the wait method on an object3) calli ng

22、 the no tify method on an object4) calli ng a read method on an In putStream object5) calli ng the setPriority method on a thread objectQuestion 18)Which of the followingare correct, if you compile thefollowi ng codepublic class CloseWindowextendsFrame implementsWin dowListe ner public CloseWi ndow(

23、) addWi ndowListe ner(this); / This is liste ner registrati onsetSize(300, 300);setVisible(true); public void win dowClos in g(Wi ndowEve nt e) System.exit(0); public static void mai n( Stri ng args) CloseWi ndow CW = new CloseWi ndow(); 1) Compile time error2) Run time error3) Code compiles but Fra

24、mes does not liste ntoWin dowEve nts4) Compile and runs successfullyQuestion 19)Which statements describe guaranteed behavior of the garbage collecti on and fin alizati on mecha ni sms1) Objects are deleted whe n they can no Ion ger be 11accessed through any referen ce.2) The fin alize() method will

25、 eve ntually be called on every object.3) The finalize() method will never be called more than once on an object.4) An object will not be garbage collected as long as it is possible for an active part of the program to access it through a refere nee.5) The garbage collector will use a mark and sweep

26、 algorithm.Question 20)A class desig n requires that a member variable should be accessible only by same package,which modifer word should be used1) protected2) public3) no modifer4) private二.简答题。(80)(请注意字迹填写工整)2.1说明SQL语言中的Select中的Having子句作用。(5)2.2 解释 Un io n All 与 Un io n 的区别。(5)2.3现有关系数据库如下(20)学生(

27、学号,姓名,性别,专业,奖学金)课程(课程号,名称,学分) 学习(学号,课程号,分数) 用SQL语言实现以下四 小题。1、 检索没有获得奖学金、同时至少有一门课程成绩在95分以 上的学生信息,包括学号、姓名、专业。(5)2、检索没有任何一门课程成绩在 80分以下的所有学生信息, 包括学号、姓名、专业。(5)3、对成绩得过满分(100分)的学生,如果没有获得奖学金的, 将其奖学金设为1000元。(5)4、 定义学生成绩得过满分(100分)的课程视图vwAAA,包 括课程号、名称和学分。(5)2.5用java实现快速排序算法。(5)2.6 RuntimeException与Exception 的区

28、别,并列举你所知道的 RuntimeException 类。(5)2.7 ArrayList 和 Vector,HashMap,Hashtable哪些是线程安全的。HashMap 和 Hashtable 哪个可以用 null 作为 key 和 value。(5)2.8抽象类与接口的相同与不同的描述?(5)2.9请把ab , ef , cd , ij , gh 这5个字符串按给定的顺序加入 到一个List对象,然后对该List对象进行快速排序,并打印结果(用 java代码实现)。(5)2.10 拷贝 c:temp.txt 文件为 c:temp2.txt 文件(用 java 代码 实现)(5)2.11 JNDI的全称是什么,简单描述它的用途。(5)2.12 JDBC 中 Statement 和 PreparedStatement 有什么不同? 简要说明PreparedStatement 对性能的影响(5)2.13请完成程序,查询tablel表中fieldl字段的值是1的纪录, 并将查询结果定位到查询结果中的第三行并打印第三行的 vcField的 值,field1字段类型是number (用java代码实现)。(5)2.14线程有哪两种实现方法(5)14

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1