长理培训真题库
我的
军队文职考试一本通

上海德邦物流股份有限公司招聘java面试真题

2020-07-16 22:47
上海德邦物流股份有限公司招聘 java 面试真题 一、选择题(20) [含多选]。(请在正确的答案上打”√”) Question 1) Which of the following statements are true? 1) An interface can only contain method and not variables 2) Interfaces cannot have constructors 3) A class may extend only one other class and implement only one interface 4) Interfaces are the Java approach to addressing its lack of multiple inheritance, but requ ire implementing classes to create the functionality of the Interfaces. Question 2) Which of the following statements are true? 1) The garbage collection algorithm in Java is vendor implemented 2) The size of primitives is platform dependent 3) The default type for a numerical literal with decimal component is a float. 4) You can modify the value in an Instance of the Integer class with the setValue method Question 3) Which of the following are true statements? 1) I/O in Java can only be performed using the Listener classes 2) The RandomAccessFile class allows you to move directly to any point a file. 3) The creation of a named instance of the File class creates a matching file in the underl ying operating system only when the close method is called. 4) The characteristics of an instance of the File class such as the directory separator, dep end on the current underlying operating system Question 4) What will happen when you attempt to compile and run the following code class Base{ public void Base(){ System.out.println(“Base”);}} public class In extends Base{ public static void main(String argv[]){ In i=new In();}} 1) Compile time error Base is a keyword 2) Compilation and no output at runtime 3) Output of Base 4) Runtime error Base has no valid constructor Question 5) You have a public class called myclass with the main method defined as follows public static void main(String parm[]){ System.out.println(parm[0]);} If you attempt to compile the class and run the program as follows java myclass hello What will happen? 1) Compile time error, main is not correctly defined 2) Run time error, main is not correctly defined 3) Compilation and output of java 4) Compilation and output of hello Question 6) Which of the following statements are NOT true? 1) 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-classed 3) All methods in an abstract class must be declared as abstract 4) transient and volatile are Java modifiers Question 7) What will happen when you attempt to compile and run the following class? class Base{ Base(int i){ System.out.println(“Base”); } } class Severn extends Base{ public static void main(String argv[]){ Severn s = new Severn(); } void Severn(){ System.out.println(“Severn”); } } 1) Compilation and output of the string ”Severn” at runtime 2) Compilation and no output at runtime 3) Compile time error 4) Compilation and output of the string ”Base” Question 8) Which of the following statements are true? 1) Static methods cannot be overriden to be non static 2) Static methods cannot be declared as private 3) Private methods cannot be overloaded 4) An overloaded method cannot throw exceptions not checked in the base class Question 9) Which of the following statements are true? 1) The automatic garbage collection of the JVM prevents programs from ever running out of memory 2) A program can suggest that garbage collection be performed but not force it 3) Garbage collection is platform independent 4) An object becomes eligible for garbage collection when all references denoting it are s et to null. Question 10) Given the following code public class Sytch{ int x=2000; public static void main(String argv[]){ System.out.println(“Ms ”+argv[1]+”Please pay $”+x); } } What will happen if you attempt to compile and run this code with the command line java Sytch Jones Diggle 1) Compilation and output of Ms Diggle Please pay $2000 2) Compile time error 3) Compilation and output of Ms Jones Please pay $2000 4) Compilation but runtime error Question 11) You need to read in the lines of a large text file containing tens of megabytes of data. Whic h of the following would be most suitable for reading in such a file 1) new FileInputStream(“file.name”) 2) new InputStreamReader(new FileInputStream(“file.name”)) 3) new BufferedReader(new InputStreamReader(new FileInputStream(“file.name”))); 4) new RandomAccessFile raf=new RandomAccessFile(“myfile.txt”,”+rw”); Question 12) Which of the following statements are true? 1) Constructors cannot have a visibility modifier 2) Constructors are not inherited 3) Constructors can only have a primitive return type 4) Constructors can be marked public and protected, but not private Question 13) Which statement is true? 1)An anonymous inner class 2)An anonymous inner class 3)An anonymous inner class 4)An anonymous inner class may be declared as final. can be declared as private. can implement multiple interfaces . can access final variables in any enclosing scope.
温馨提示:当前文档最多只能预览 4 页,此文档共9 页,请下载原文档以浏览全部内容。如果当前文档预览出现乱码或未能正常浏览,请先下载原文档进行浏览。
上海德邦物流股份有限公司招聘java面试真题 第 1 页上海德邦物流股份有限公司招聘java面试真题 第 2 页上海德邦物流股份有限公司招聘java面试真题 第 3 页上海德邦物流股份有限公司招聘java面试真题 第 4 页

下载提示

1 该文档不包含其他附件(如表格、图纸),本站只保证下载后内容跟在线阅读一样,不确保内容完整性,请务必认真阅读

2 除PDF格式下载后需转换成word才能编辑,其他下载后均可以随意编辑修改

3 有的标题标有”最新”、多篇,实质内容并不相符,下载内容以在线阅读为准,请认真阅读全文再下载

4 该文档为会员上传,版权归上传者负责解释,如若侵犯你的隐私或权利,请联系客服投诉

最近更新

热门排行