- 23
- 0
- 约5.03千字
- 约 7页
- 2018-03-28 发布于重庆
- 举报
欣网视讯java笔试题-包括算法题
JAVA笔试题
本次笔试题时间共60分钟,如空间不够请在背面书写。
不定向选择题(每小题3分,共10题)
List,Set,Map是否继承自Collection接口
都是 B. 都不是 C.List,Set是 D.Set,Map是
正确答案( C )
下面描述哪个是正确的
构造器Constructor可被override
可以继承String类
Try 里有一个return语句,那么紧跟在这个try后的finally 里的code不会被执行
两个对象值相同(x.equals y true),那么也有相同的hash code
正确答案( D )
Abstract的method是否可同时是static,是否可同时是native,是否可同时是synchronized
都能 B.都不能 C.可以为static D.可以为native
正确答案( B )
下面的程序中,temp的最终值是什么? long temp int 3.9; temp% 2;
0 B.1 C. 2 D.3
正确答案( B )
下面的语句会产生什么样的输出?
System.out.println 47 ;
4 B. 5 C.6 D.7
正确答案( A )
请在以下选项中选出是基本数据类型的选项( )
A.int B.byte C.boolean D.String
正确答案( ABC )
阅读下面代码:
public class Test public static void main String args[] int i 0Xfffffff5;
int j ~i;
System.out.println “The value of j is : ”+ j ; ]
]
输出j的结果是( )
A. 10 B. 1 C. 14 D.-15
正确答案是( A )//拿到的卷子,这题选项中可能没有10,是陷阱,切记答案是10
8.阅读以下代码段 byte k 3; System.out.println k 3 ; System.out.println k 1 ;
请选择输出结果( ) A.9.2 B. 24.1 C. -24.0 D.16.-1
正确答案( B )
阅读下面代码,选择执行结果;
Math.round 12.367*Math.round 10.2 /Math.round 10.2 ; A.12.36 B.12 C.12.37 D.12.3
正确答案( B )//可能题目是Math.pow,不要慌,还是选这个
给出以下代码的输出结果
public class Testdata public String getValue String value “ ”; try value “test1”; return value; catch Exception e e.printStackTrace ; finally value “test12” ; return value; public static void main String args[] TestData test new TestData ; String a test.getValue ; System.out.println a ; A. test1 B.test2 C.null D.” ”
正确答案( A )
判断题,如果有错误,请指出并修正。(每小题3分,共5题)
1.
interface A Int a 0; class B int a 1; class C extends B impleaents A public void pX Systen.out.println a ; public static void main String[] args new C .pX ; 答案:
方法pX 中的变量a有歧义,正确的写法是A.a.
原因:在static方法main中只能引用static变量,而interface中的变量默认访问范围是public static,但是class中的变量默认访问范围是package.
2.
class Data int i 1; public class TestData Data al new Data ;
final Data a2 new Data ;
final Data a21;
static final Data a3 new Data ;
public static void main String[] args TestData test new TestData ;
原创力文档

文档评论(0)