1 / 9
文档名称:

JAVA程序员笔试题目与答案.doc

格式:doc   大小:108KB   页数:9页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

JAVA程序员笔试题目与答案.doc

上传人:oj63jyfa79 2017/3/29 文件大小:108 KB

下载得到文件列表

JAVA程序员笔试题目与答案.doc

文档介绍

文档介绍:1. Given: Integer i= new Integer (42); Long l= new Long (42); Double d= new Double (); Which two expressions evaluate to True? A. (i == 1) B. (i == d) C. (d == 1) D. ( (l)) E. ( (l)) F. ( (42)) G. none of above Answer: 2. Given: public class Foo { public static void main (String [] args) { StringBuffer a= new StringBuffer("A"); StringBuffer b= new StringBuffer ("B"); operate (a,b); (a + "," +b); } static void operate(StringBuffer x, StringBuffer y){ (y); y= x;}} What is the result? A. The piles and prints “ A,B ”. B. The piles and prints “ A,A ”. C. The piles and prints “ B,B ”. D. The piles and prints “ AB,B ”. E. The piles and prints “ AB,AB ”. F. The code does pile because “+” cannot be overloaded for StringBuffer. Answer: : class BaseClass { private float x= ; protected float getVar() {return x;} } class Subclass extends BaseClass { private float x= ; //insert here } Which two are valid examples of method overriding? A. float getVar() { return x;} B. public float getVar() { return x;} C. public double getVar() { return x;} D. protected float getVar() { return x;} E. public float getVar(float f){ return f;} Answer: 4. Which of the following are methods of the Runnable interface A) run B) start C) yield D) stop Answer: 5. Which of the following are legal statements? A) float f=1/3; B) int i=1/3; C) float f=