java基础部分面试千题库(编辑修改稿)内容摘要:
e } 18. } 下列哪句代码放到第 16 行,可以导致一个 ( ) a) Alpha a = x。 b) Foo f = (Delta)x。 c) Foo f = (Alpha)x。 d) Beta b = (Beta)(Alpha)x。 37) 22. public void go() { String o =。 z: . for(int x = 0。 x 3。 x++) { for(int y = 0。 y 2。 y++) { if(x==1) break。 if(x==2 amp。 amp。 y==1) break z。 o = o + x + y。 } } (o)。 }当调用 go 方法时,输出结果是什么( ) a) 00 b) 0001 c) 000120 d) 000120221 38) 11. static void test() throws RuntimeException { try { (test )。 throw new RuntimeException()。 } catch (Exception ex) { (exception )。 } } public static void main(String[] args) { try { test()。 } catch (RuntimeException ex) { (runtime )。 } (end )。 }程序运行结果是( ) a) test end b) Compilation fails. c) test runtime end d) test exception end e) .A Throwable is thrown by main at runtime 39) 33. try { // some code here } catch (NullPointerException e1) { (a)。 } catch (Exception e2) { (b)。 } finally { (c)。 }如果程序的第 34 行会抛出一些异常,程序的运行结果是( ) a) a b) b c) c d) ac e) abc 40) 31. // some code here try { // some code here } catch (SomeException se) { // some code here } finally { // some code here } 哪种情况下 37 行的代码会执行,请选择 3 个( ) a) The instance gets garbage collected. b) The code on line 33 throws an exception. c) The code on line 35 throws an exception. d) The code on line 31 throws an exception. e) The code on line 33 executes successfully. 41) 10. int x = 0。 int y = 10。 do { y。 ++x。 } while (x 5)。 (x + , + y)。 程序运行结果是( ) a) 5, 6 b) 5, 5 c) 6, 5 d) 6, 6 42) public class Drink { public static void main(String[] args) { boolean assertsOn = true。 assert (assertsOn) : assertsOn = true。 if(assertsOn) { (assert is on)。 } } }程序运行结果是( ) a) no output b) no output assert is on c) assert is on d) assert is on An AssertionError is thrown. 43) 11. Float pi = new Float()。 if (pi 3) { (pi is bigger than 3. )。 } else { (pi is not bigger than 3. )。 } finally { (Have a nice day.)。 }程序运行结果是( ) a) Compilation fails. b) pi is bigger than 3 c) An exception occurs at runtime. d) pi is bigger than 3. Have a nice day. e) pi is not bigger than 3. Have a nice day. 44) 1. public class Boxer1{ Integer i。 int x。 public Boxer1(int y) { x = i+y。 (x)。 } public static void main(String[] args) { new Boxer1(new Integer(4))。 } }运行结果是( ) a) The value 4 is printed at the mand line. b) Compilation fails because of an error in line 5. c) A NullPointerException occurs at runtime. d) A NumberFormatException occurs at runtime. 45) 1. public class Person { private String name。 public Person(String name) { = name。 } public boolean equals(Person p) { return ()。 6. } 7. } 下列哪条语句是正确的( ) a) The equals method does NOT properly override the method. b) Compilation fails because the private attribute cannot be accessed in line 5. c) To work correctly with hashbased data structures, this class must also implement the hashCode method. d) When adding Person objects to a collection, the equals method in line 4 will prevent duplicates. 46) 1. public class Score implements Comparable { private int wins, losses。 public Score(int w, int l) { wins = w。 losses = l。 } public int getWins() { return wins。 } public int getLosses() { return losses。 } public String toString() { return + wins + , + losses +。 } // insert code here }下列哪句代码放到第 9 行,程序可以正确编译( ) a) public int pareTo(Object o){/*more code here*/} b) public int pareTo(Score other){/*more code here*/} c) public int pare(Score s1,Score s2){/*more code here*/} d) public int pare(Object o1,Object o2){/*more code here*/} 47) 3. public class Batman { int squares = 81。 public static void main(String[] args) { new Batman().go()。 } void go() { incr(++squares)。 (squares)。 } void incr(int squares) { squares += 10。 } }程序运行结果是( ) a) 81 b) 82 c) 91 d) 92 48) 15. public class Yippee { public static void main(String [] args) { for(int x = 1。 x。 x++) { (args[x] + )。 19. } 20. } 21. } 在控制台依次输入两条命令 java Yippee java Yippee 1 2 3 4 程序的运行结 果是( ) a) No output is produced. 1 2 3 b) No output is produced. 2 3 4 c) No output is produced. 1 2 3 4 d) An exception is thrown at runtime. 1 2 3 e) An exception is thrown at runtime. 2 3 4 f) An exception is thrown at runtime. 1 2 3 4 49) 13. public class Pass { public static void main(String [] args) { int x = 5。 Pass p = new Pass()。 (x)。 ( main x = + x)。 } 21. void doStuff(int x) { ( doStuff x = + x++)。 } }程序的运行结果是( ) a) Compilation fails. b) An exception is thrown at runtime. c) doStuff x = 6 main x = 6 d) doStuff x = 5 main x = 5 e) doStuff x = 5 main x = 6 f) doStuff x = 6 main x = 5 50) 3. interface Animal { void makeNoise()。 } class Horse implements Animal { Long weight = 1200L。 public void makeNoise() { (whinny)。 } } public class Icelandic extends Horse { public void makeNoise() { (vinny)。 } public static void main(String[] args) { Icelandic i1 = new Icelandic()。 Icelandic i2 = new Icelandic()。 12. Icelandic i3 = new Icelandic()。 i3 = i1。 i1 = i2。 i2 = null。 i3 = i1。 } }程序运行结束后,有几个对象符合垃圾回收的条件( ) a) 0 b) 1 c) 2 d) 3 e) 4 f) 6 51) 11. String[] elements = { for, tea, too }。 String first = ( 0) elements[0] : null。 程序运行结果是( ) a) Compilation fails. b) An exception is thrown at runtime. c) The variable first is set to null. d) The variable first is set to elements[0]. 52) 31. class Foo { public int a = 3。 public void addFive() { a += 5。 (f )。 } } class Bar ext。java基础部分面试千题库(编辑修改稿)
相关推荐
时,箱体外壳上应标明: a. 制造厂名称; b. 产品型号、规格及额定电压: mm2, V; c. 箱体外形尺寸及重量, kg; d. 防潮,防掷标志。 7. 4 出口产品的包装应按有关规定执行。 附 录 A 中碱玻璃纤维纱的规格及机械物理性能 (补充件 ) 牌号 单纤维公称直径 μ m 股数 公制支数 (公制号数 ) 支数不匀率不大于 % 断裂强度不小于 g 捻向 捻度 捻/米 中碱纱 6—
味道,不象澡堂,象消毒后的庙。 静静爬着, 16 加 12 层的纱布,让人 透不过气来,闷吼了一声:师傅,快一点:很拽啊,象宇航员:哼哼,防水的防化服,紧俏的很:橡胶的手套也能搓澡。 :您就瞧好吧:„„:您的体温有点偏高:你搓的:您的眼神有点呆滞:烟熏的:您的背肌有点酸痛吧:你再使点劲,它还会青呢:您哪的人:北京的:„„:„„:„„:师傅,就算是北京的,你也不能往死里掐啊„ 2020228 16
”“就剩点零钱在我这儿呢,你不用管了。 ”。 六 我们科长记忆力十分好,某年某月某人找他借过多少钱,他永远不会忘。 工作中的事也是这样,其 实每一件他都会记得,不过他总是不放心,于是他再一一吩咐我一遍,让我某年某月某日提醒他做某事。 而我的记忆一直是时有时无的,为了不耽误事,我把他的叮嘱不厌其烦地记在手机里,记在电脑中,记在笔记本上,只差刻在额头了。 结果往往是到了那一天,科长办完事回来
四川 重庆电机厂 2 机械密封 自贡 密封件厂 自贡 重庆 密封件厂 沈阳 密封件厂 7 设计、制造、安装和试验标准 、《单吸单吸离心水泵技术条件》 GB565785 、《离心泵、混流泵、轴流泵和旋涡泵试验方法》 GB321689 、《泵的振动测量与评价方法》 GB1088989 、《泵的噪声测量与评价方法》 GB1089089 、《离心泵、混流泵和轴流泵汽蚀余量》 GB/T1300691
破碎,也不去怪水,只因为灌水太美,就算日日灌,夜夜灌,时时灌也不会累;我埋头灌水,永不知疲惫,最怕斑竹让我一去不回,即使封一次,封两次,封十次都无所谓。 69.就是喜欢你,不行阿。 谁让你是美女呢。 70.士为知己者死,导师是偶的知己么。 不是,所以我不必为他的课题死掉 还等什么。 推掉算了„„ 女为悦己者容,对面的 mm 真的 pp 么。 是的,所以她当然是为了你而梳妆喽 还等什么。
等身”是用来形容科研水平高,原来“苹果等身”是用来形容感情深啊,顿悟。 (感谢 beibei18187的推荐)量高度 张某应电力公司之请,去给一批电线杆量高度。 张某来到电力公司后看了看地上的电线杆,然后对电力公司负责人说:“你去找几个高大的人来,把电线杆竖起来,我要爬上去量。 “电力公司负责人不解地问:“为什么要爬上去量,而不是在地上量呢。 ”张某回答说:“我要量的是高度不是长度。