德邦java面试题_第1页
德邦java面试题_第2页
德邦java面试题_第3页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 terfaces ar

2、e 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 primitives

3、 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 tegerclass with the setValue methodQuesti on 3)Which of the followi ng are true stateme nts1) I/O in Java can only be performed using the Liste

4、ner 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 File class

5、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()public class In exte nds Basepublic static void main( Stri ng argv)In i=new In ();1) Compile time err

6、or 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)If you attempt to compile the class and run t

7、he 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 on 6)Which of the followi ng stateme nts are NOT true1) If a cla

8、ss 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 Java modifiersQuesti on 7)What will happe n whe n you attempt t

9、o compile and runthe followi ng classclass BaseBase(i nt i)class Sever n exte nds Basepublic static void main( Stri ng argv)Sever n s = new Sever n();void Sever n()1) Compilati on and output of the stri ng Sever n at run time2) Compilati on and no output at run time3) Compile time error4) Compilati

10、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 declared as private3) Private methods cannot be overloadednotbe4) An overloaded method cannot throw exceptions checked in the ba

11、se 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 suggest that garbage collection performed but not force it3) Garbage collecti on is platform in depe ndent4) An object bec

12、omes 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 main( Stri ng argv)What will happe n if you attempt to compile and run thiscode with the comma nd linejava Sytch Jones Diggle1

13、) Compilatio n and output of Ms Diggle Please pay $20002) Compile time error3) Compilatio n and output of Ms Jones Please pay $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 bemo

14、st suitable for read ing in such a file1) new FileI nputStream( file. name )2) newIn putStreamReader( newFileI nputStream( file. name )3) newBufferedReader( newIn putStreamReader( newFileI nputStream( file. name );4) newRan domAccessFileraf= newRan domAccessFile( myfile.txt , +rw );Question 12)Which

15、 of the followi ng stateme nts are true1) Con structors cannot have a visibility modifier2) Con structors are n ot in herited3) 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

16、 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 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

17、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 = new Strin gBuffer( A );Stri ngBuffer b = new Stri ngBuffer( B ); operate(a,b);static void operate(Stri ngBufer x,Stri ngBuffer y)x.appe nd(y);y=x; What is the result1) The

18、code compiles and prints“A.B” .2) The code compiles and prints“A.A ” .3) The code compiles and prints“ 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 t

19、o ready.3) From running to wait ing.4) From wait ing to running.5) From wait ing to ready.6) From 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) 1)

20、 Compiler error complai ning about access restrictio n of private 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

21、 zed block2) calli ng the wait method on an object3) calli ng 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 CloseWindo

22、wextendsFrame implementsWin dowListe ner public CloseWi ndow() 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

23、) Compile time error2) Run time error3) Code compiles but Frames 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 acc

24、essed through any referen ce.2) The fin alize() method will 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 re

25、fere nee.5) The garbage collector will use a mark and sweep 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现有关系数据库如

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论