【单选题】【消耗次数:1】
下列程序执行的结果是( ) 。 public class X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println(Finally); } } }
程序正常运行,但不输出任何结果
程序正常运行,并输出 Finally
编译通过,但运行时出现异常
因为没有 catch 子句,因此不能通过编译
参考答案:
复制
纠错
相关题目
【单选题】 编译运行以下程序后,关于输出结果的说明正确的是 ( ) public class Conditional{ public static void main(String args[ ]){ int x=4; System.out.println(“value is “+ ((x>4) ? 9.9:9)); } }
①  输出结果为:value is 99.9
②  输出结果为:value is 9
③  输出结果为:value is 9.0
④  编译错误
【单选题】 以下程序的运行结果是:( ) public class Increment{ public static void main(String args[]){ int c; c = 2; System.out.println(@@; System.out.println(c++); System.out.println(@@; } }
①  2 2 2
②  2 3 3
③  2 2 3
④  3 4 4
【单选题】 下列程序的运行结果是( ) 。 public class X5_1_2 extends x{ int ab() { static int aa=10; aa++; System.out.println(aa); } public static void main(String[] args) { X5_1_2 x=new X5_1_2(); x.ab(); } }
①  10
②  11
③  编译错误
④  运行成功,但不输出
【单选题】 下面代码运行后的输出结果为( ) 。 public class X6_1_5 { public static void main(String[] args) { AB aa = new AB(); AB bb; bb = aa; System.out.println(b@@equals(aa)); } } class AB{ int x = 100; }
①  true
②  false
③  编译错误
④  100
【单选题】 阅读以下代码: import java.io.*; import java.util.*; public class foo{ public static void main (String[] args){ String s; System.out.println(s= + s); } } 输出结果应该是:( )
①  代码得到编译,并输出“s=”
②  代码得到编译,并输出“s=null”
③  由于String s没有初始化,代码不能编译通过
④  代码得到编译,但捕获到 NullPointException异常
【单选题】 编译下面源程序会得到哪些文件( )? class A1{ } class A2{ } public class B{ public static void main(String[] args) { } }
①  只有B.class 文件
②  只有 A1.class 和 A2.class 文件
③  编译不成功
④  A1.class、A2.class 和B.class 文件
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_4 { public static void main(String[] args) { int x = 0; int y = 5/x; int[] z = { 1,2,3,4 } ; int p = z[4]; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 运行下面程序时,会产生什么异常?( ) public class X7_1_5 { public static void main(String[] args) { int[] z = { 1,2,3,4 } ; int p = z[4]; int x = 0; int y = 5/x; } }
①  ArithmeticException
②  NumberFormatException
③  ArrayIndexOutOfBoundsException
④  IOException
【单选题】 下列程序从标准输入设备读入一个字符, 然后再输出到显示器, 选择正确的一项填入“//x” 处,完成要求的功能( ) 。 import java.io.*; public class X8_1_4 { public static void main(String[] args) { char ch; try{ //x System.out.println(ch); } catch(IOException e) { e.printStackTrace(); } } }
①  ch = System.in.read();
②  ch = (char)System.in.read();
③  ch = (char)System.in.readln();
④  ch = (int)System.in.read();
【单选题】 关于以下application的说明,正确的是( ) 1. class StaticStuff 2. { 3. static int x=10; 4. static { x+=5;} 5. public static void main(String args[ ]) 6. { 7. System.out.println(“x=” + x); 8. } 9. static { x/=3;} 10. }
①  4行与9行不能通过编译,因为缺少方法名和返回类型
②  9行不能通过编译,因为只能有一个静态初始化器
③  编译通过,执行结果为:x=5
④  编译通过,执行结果为:x=3
随机题目
【多选题】 梁陈时期尚自然、主风力的诗人是
①  沈约
②  吴均
③  萧纲
④  何逊
⑤  阴铿
【多选题】 关于《诗经》的 收集和编订,历来影响较大的有
①  先秦时期产生的“献诗”说
②  汉代人郑玄编订说
③  汉代班固《汉书*食货志》的“采诗”说
④  汉代司马迁提出的“孔子删诗”说
⑤  赵人毛苌收集并编订说
【多选题】 今传为蔡琰所作的诗有
①  《七哀诗》三首
②  五言《悲愤诗》
③  七言《悲愤诗》
④  《饮马长城窟行》
⑤  《胡笳十八拍》
【单选题】 为唐代律赋奠定了坚实基础的是
①  南朝的骈体赋
②  东晋的山水赋
③  抒情小赋
④  庾信的《哀江南赋》
【单选题】 永明是
①  南朝齐武帝年号
②  南朝宋文帝年号
③  南朝梁元帝年号
④  南朝陈后主年号
【单选题】 东晋初年诗坛的重要诗人和诗歌是
①  刘琨及其《重赠卢谌》
②  郭璞和他的《游仙诗》
③  孙绰、许询和他们的玄言诗歌
④  陶渊明和他的田园诗
【单选题】 曹植后期诗歌典型的代表作是
①  《白马篇》
②  《美女篇》
③  《送应氏》
④  《赠白马王彪》
【单选题】 我们乐府诗歌中最长的一首叙事诗是
①  《离骚》
②  《孔雀东南飞》
③  《木兰诗》
④  《陌上桑》
【单选题】 江淹赋的代表作是
①  《恨赋》和《别赋》
②  《江赋》和《海赋》
③  《秋兴赋》和《闲居赋》
④  《归田赋》和《惮亡赋》
【单选题】 《论贵粟书》的作者是
①  贾山
②  贾谊
③  晁错
④  董仲舒