【单选题】【消耗次数:1】
编译运行以下程序后,关于输出结果的说明正确的是 ( ) 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 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
【单选题】 下列程序执行的结果是( ) 。 public class X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println(Finally); } } }
①  程序正常运行,但不输出任何结果
②  程序正常运行,并输出 Finally
③  编译通过,但运行时出现异常
④  因为没有 catch 子句,因此不能通过编译
【单选题】 阅读以下代码: 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异常
【单选题】 下列程序的运行结果是( ) 。 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
③  编译错误
④  运行成功,但不输出
【单选题】 关于以下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
【单选题】 System.out.println(5 + 2);的输出结果应该是( )。
①  52
②  7
③  2
④  5
【单选题】 运行下面程序时,会产生什么异常?( ) 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
【单选题】 编译下面源程序会得到哪些文件( )? 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 文件
【单选题】 下列程序从标准输入设备读入一个字符, 然后再输出到显示器, 选择正确的一项填入“//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();
随机题目
【单选题】 <img src=http://huaweicloudobs.ahjxjy.cn/b6592601b38d2119621dbe4c6eb9a29b.jpg/>
①  y=1+lnx(x0)
②  y=1-lnx(x0)
③  y=-1+lnx(x0)
④  y=-1-lnx(x0)
【单选题】 ()描述系统的动态动作和组成系统的对象间的交互关系,包括状态图与活动图。
①  静态图
②  行为图
③  交互图
④  用例图
【单选题】 以下说法正确的是( )。
①  FORTRAN语言的某此特性,使程序运行效率高
②  Pascal语言是世界上第一个被正式推广应用的计算机语言
③  C语言是第一个体现结构化编程思想的语言
④  PL/1能够适用于多种不同的应用领域,因太庞大,难以推广使用
【判断题】 进行程序设计语言的选择时,首先考虑的是应用领域。
①  正确
②  错误
【单选题】 已知三个球的体积之比为1:8:27,则它们的表面积之比为( )
①  1:2:3
②  1:4:9
③  2:3:4
④  1:8:27
【简答题】 通过类结构对接口和实现的分析,面向对象设计可以实现[填空]。
【单选题】 每层子系统仅仅使用其直接下层提供的服务,属于( )结构。
①  开放式层次
②  封闭式层次
③  块状组织
④  混合
【简答题】 用低级语言开发的程序,具有[填空]特点。
【单选题】 ()它又称合作图,它和时序图一样,也是用于描述对象间的交互关系,侧重说明哪些对象之间有消息传递
①  状态图
②  活动图
③  顺序图
④  协作图
【单选题】 一个几何体的三视图形状都相同,大小均等,那么这个几何体不可以是( )
① 
②  三棱锥
③  正方体
④  圆柱