设为首页 加入收藏

TOP

德邦java面试题(一)
2014-11-24 01:40:39 来源: 作者: 【 】 浏览:30
Tags:德邦 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 require 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 underlying operating system only when the close method is called.


4) The characteristics of an instance of the File class such as the directory separator, depend 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 cann

首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇用递归算法解决汉塔问题 下一篇算法面试题 精心收集

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: