【单选题】【消耗次数: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↙
随机题目
【单选题】 收到美东公司投入资金10 000元 ,存入银行,该业务的会计处理是( )
①  借:银行存款 10 000  贷:实收资本—美东公司 10 000
②  借:实收资本—美东公司 10 000  贷:银行存款    10 000
③  借:银行存款     10 000  贷:资本公积—美东公司   10 000
④  借:库存现金     10 000  贷:实收资本—美东公司   10 000
【单选题】 收到A公司违约金1000元,存入银行,该业务的会计处理是( )
①  借:银行存款 1000 贷:其他业务收入 1000
②  借:银行存款 1000 贷:主营业务收入 1000
③  借:银行存款 1000 贷:营业外收入 1000
④  借:主营业务成本 1000 贷:其他业务收入 1000
【单选题】 下列项目中,属于所有者权益的是( )
①  房屋
②  银行存款
③  短期借款
④  未分配利润
【多选题】 企业实现的净利润应进行下列分配 ( )
①  计算缴纳所得税
②  支付子弟学校经费
③  提取法定盈余公积金
④  提取任意盈余公积金
⑤  向投资人分配利润
【多选题】 下列账户中,在期末结账后有余额的是( )
①  生产成本
②  在途物资
③  管理费用
④  主营业务收入
⑤  制造费用
【多选题】 借贷记账法的记账规则是( )
①  有借必有贷
②  借贷必相等
③  借方登记增加数
④  贷方登记减少数
⑤  余额在借方
【多选题】 企业分配工资费用时,应贷记“应付职工薪酬”科目,借记以下有关科目( )
①  生产成本
②  制造费用
③  管理费用
④  销售费用
⑤  财务费用
【多选题】 下列项目中属于流动负债的有( )
①  短期借款
②  应付账款
③  预收账款
④  应交税费
⑤  长期借款
【多选题】 下列各项中属于会计核算基本前提的有( )
①  会计主体
②  持续经营
③  货币计量
④  会计分期
⑤  权责发生制
【多选题】 每一笔会计分录都包括( )
①  账户名称
②  记账方向
③  金额
④  会计科目编号
⑤  会计凭证号