题目内容 (请给出正确答案)
[单选题]

给定如下Java程序,Test类中的四个输出语句输出结果依次是 。 class Person { String name="person"; public void shout(); } }

A.true,false,true,false

B.false,true,false,false

C.true,true,true,编译错误

D.true,true,false,编译错误

提问人:网友lixin080108 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有3位网友选择 B,占比33.33%
  • · 有3位网友选择 C,占比33.33%
  • · 有2位网友选择 A,占比22.22%
  • · 有1位网友选择 D,占比11.11%
匿名网友 选择了B
[35.***.***.148] 1天前
匿名网友 选择了D
[32.***.***.12] 1天前
匿名网友 选择了C
[221.***.***.2] 1天前
匿名网友 选择了B
[107.***.***.222] 1天前
匿名网友 选择了C
[153.***.***.215] 1天前
匿名网友 选择了A
[238.***.***.170] 1天前
匿名网友 选择了B
[139.***.***.233] 1天前
匿名网友 选择了A
[10.***.***.125] 1天前
匿名网友 选择了C
[224.***.***.211] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“给定如下Java程序,Test类中的四个输出语句输出结果依次…”相关的问题
第1题
给定如下Java程序,这段程序编译运行后的输出结果是( ) public class Test{ public static void aMethod() throws Exception{ try{ throw new Exception(); }finally{ System.out.print("Finally"); } } public static void main(String[]args){ try{ aMethod(); }catch(Exception e){ System.out.print("Finished"); } } }

A、FinallyException

B、Finally

C、FinishedFinally

D、FinalyFinished

点击查看答案
第2题
5、编写一个java application程序,其中类声明为public class StringDemo,那么该程序应该以什么文件名来保存?( ) A、StringDemo.java B、StringDemo.class C、Strindemo.java D、StringDemo.txt
点击查看答案
第3题
给定java 代码,如下,编译运行后,结果是( )。 public class Test{ static String s; public static void main(String args[]) { char c=s.charAt(0); System.out.println(c); } }

A、编译错误

B、运行期异常,异常类型为NullPointerException

C、运行期异常,异常类型为ArithmeticExceptioin

D、正确运行,但无输出内容

点击查看答案
第4题
【资料题】(6-6)请阅读程序,写出程序运行结果。 class Test{ static int x=10; int y=99; { y=y+10; } static { x=x+5; } { y=y+10; } static { x=x+5; } public Test() {//构造方法 x=x+5; } { System.out.println(x*y); } } public class Demo11 { public static void main(String[] args) { Test t1=new Test(); Test t2=new Test(); } }
点击查看答案
第5题
关于下面的程序Test.java说法正确的是()。public class Test {String x="1";int y;
关于下面的程序Test.java说法正确的是()。

public class Test {

String x="1";

int y;

public static void main(String args[]) {

int z=2;

System.out.println(x+y+z);

}

}

A.3

B.102

C.12

D.程序有编译错误

点击查看答案
第6题
(File类)下列程序运行后的结果可能是________。import java. io. *; public class Test { public static void main (String [] args) { File file =new File ( "hello . txt" ) ; if (file. exists () ) { file.delete () ; } else { try { file . createNewFile ( ) ; } catch (Exception e ) { e .printStackTrace ( ) ; } } } }

A、如果文件不存在 ,则程序退出

B、如果文件已经存在 , 则程序退出

C、如果文件已经存在,则保留该文件

D、如果文件不存在 , 则创建该文件

点击查看答案
第7题
设有如下程序: public class Test5 { public static void main (String args []) { /* This is the start of a comment if (true) { Test5 = new test5(); System.out.println("Done the test"); } /* This is another comment */ System.out.println ("The end"); } } 结果为?

A、输出 "Done the test".

B、程序输出"The end"

C、程序编译错误.

D、程序输出"Done the test"和 "The end"

点击查看答案
第8题
分析如下的Java代码,编译运行时输出( )。 String s=new String(“JavaTest”); int i=1; int j=4; System.out.println(s.substring (i,j));

A、Java

B、Jav

C、ava

D、avaT

点击查看答案
第9题
5.如下Java代码,输出的运行结果是() public class Test{ public static void main(String[] args) { List <string> list = new ArrayList <string> (); list.add("str1"); list.add(2, "str2"); String s = list.get(1); System.out.println(s); } }

A、A.运行时出现异常

B、B.正确运行,输出str1

C、C.正确运行,输出str2

D、D.编译时出现异常

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信