【单选题】【消耗次数:1】
下列程序从标准输入设备读入一个字符, 然后再输出到显示器, 选择正确的一项填入“//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();
参考答案:
复制
纠错
相关题目
【单选题】 下列程序实现了在当前包dir815下新建一个目录subDir815,选择正确的一项填入程序的 横线处,使程序符合要求( ) 。 package dir815; import java.io.*; public class X8_1_5 { public static void main(String[] args) { char ch; try{ File path = ; if(path.mkdir()) System.out.println(successful!); 48 } catch(Exception e) { e.printStackTrace(); } } }
①  new File(subDir815);
②  new File(dir815.subDir815);
③  new File(dir815\subDir815);
④  new File(dir815/subDir815);
【单选题】 以下程序的运行结果是:( ) 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
【单选题】 阅读以下代码: 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 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 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
【单选题】 关于以下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
【单选题】 执行C程序段char ch=’a’;ch=(ch>=’a’&&ch<=’z’?(ch-32):ch;后,变量ch的值为()。
①  ‘A’
②  ‘a’
③  ‘z’
④  ‘Z’
【单选题】 若有char ch;利用getchar(ch);语句将字符“A”输入给变量ch,则输入方式()是正确的。
①  A↙
②  65↙
③  \041↙
④  \101↙
随机题目
【简答题】 鸦片战争正式爆发的标志是1840年6月英国侵华舰队封锁了[填空]。
【简答题】 应用新兴技术的培训的实施应该注意的问题有哪些?
【简答题】 评价中心采用的方法有那些?
【简答题】 工作层面的培训需求分析从哪些方面展开?
【简答题】 培训有效性评估的步骤?
【简答题】 差异化战略下的培训重点是什么?
【简答题】 根据费德勒的领导匹配理论,在特别有利和特别不利的情境中,[填空1]的管理风格更有效。
【简答题】 我们学校每年组织大家申请大学生创新创业大赛,这种训练属于[填空1]培训方法。
【简答题】 希望随心所欲安排自己的工作方式、工作习惯和生活方式的职业锚类型是[填空1]。
【简答题】 社会学习理论是由[填空1]提出来的。