【单选题】【消耗次数:1】
阅读以下代码: 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 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
④  编译错误
【单选题】 编译下面源程序会得到哪些文件( )? 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 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 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 X7_1_6 { public static void main(String[] args) { try{ return; } finally{ System.out.println(Finally); } } }
①  程序正常运行,但不输出任何结果
②  程序正常运行,并输出 Finally
③  编译通过,但运行时出现异常
④  因为没有 catch 子句,因此不能通过编译
【单选题】 应用程序的main方法中有以下语句,则输出的结果是 ( )。 String s1=new String(abc); String s2=new String(abc); boolean b1=s1.equals(s2); boolean b2=(s1==s2); System.out.print(b1+ +b2);
①  true false
②  false true
③  true true
④  false false
【单选题】 下列程序从标准输入设备读入一个字符, 然后再输出到显示器, 选择正确的一项填入“//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();
【单选题】 下列程序段执行后的结果是( )。 String s = new String(abcdefg); for (int i=0; i<s.length(); i+=2){ System.out.print(s.charAt(i)); }
①  aceg
②  ACEG
③  abcdefg
④  abcd
【单选题】 System.out.println(5 + 2);的输出结果应该是( )。
①  52
②  7
③  2
④  5
【单选题】 下列程序的运行结果是( ) 。 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
③  编译错误
④  运行成功,但不输出
随机题目
【单选题】 多媒体计算机系统主要由哪两部分组成?
①  多媒体硬件和多媒体软件
②  操作系统和输入设备
③  输出设备和系统软件
④  输入设备和输出设备
【单选题】 下列选项描述中,不是PDF格式文档的特点的是?
①  安全、可加密
②  支持特长文件
③  可以包含超文本链接等电子信息
④  集成度低
【判断题】 矢量图形通过公式计算获得,因此矢量图形文件体积比较大。
①  正确
②  错误
【判断题】 图像的分辨率越高,图像的清晰度就越低。
①  正确
②  错误
【判断题】 AVI格式占用空间小,适用于网络视频的制作。
①  正确
②  错误
【判断题】 文本的处理包括文本的采集、录入、编辑等加工处理环节。
①  正确
②  错误
【单选题】 下列关于视频文件格式的说法中,错误的是?
①  AVI、MPEG、FLV都是本地影像视频格式
②  AVI格式的优点是兼容性好,图像质量好
③  3GP是一种3G流媒体的视频编码格式
④  WMV是微软公司开发的一组数位视频编解码格式的通称
【判断题】 在PPT中,可以对文字、图片、图表、动画等多种媒体素材进行编辑和处理。
①  正确
②  错误
【单选题】 下列文件格式中,哪一个不是数字图像文件格式?
①  wav
②  gif
③  jpeg
④  psd
【判断题】 使用Flash软件可以制作静态文本、交互式文本,但是不能制作动画文本。
①  正确
②  错误