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

编译运行下面的程序,结果是什么?()publicclassA{publicstaticvoidmain(String[]args){Bb=newB();B.test();}voidtest(){System.out.print(\"A\");}}classBextendsA{voidtest(){super.test();System.out.print(\"B\");}}

A.产生编译错误

B.代码可以编译运行,并输出结果AB

C.代码可以编译运行,但没有输出

D.编译没有错误,但会产生运行时异常

提问人:网友18***192 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有5位网友选择 B,占比13.16%
  • · 有5位网友选择 D,占比13.16%
  • · 有4位网友选择 B,占比10.53%
  • · 有4位网友选择 B,占比10.53%
  • · 有3位网友选择 A,占比7.89%
  • · 有3位网友选择 C,占比7.89%
  • · 有3位网友选择 D,占比7.89%
  • · 有2位网友选择 D,占比5.26%
  • · 有2位网友选择 A,占比5.26%
  • · 有2位网友选择 A,占比5.26%
  • · 有1位网友选择 A,占比2.63%
  • · 有1位网友选择 C,占比2.63%
  • · 有1位网友选择 B,占比2.63%
  • · 有1位网友选择 C,占比2.63%
  • · 有1位网友选择 C,占比2.63%
匿名网友 选择了B
[121.***.***.175] 1天前
匿名网友 选择了D
[115.***.***.164] 1天前
匿名网友 选择了A
[41.***.***.187] 1天前
匿名网友 选择了B
[155.***.***.154] 1天前
匿名网友 选择了D
[77.***.***.116] 1天前
匿名网友 选择了B
[159.***.***.253] 1天前
匿名网友 选择了A
[74.***.***.166] 1天前
匿名网友 选择了D
[50.***.***.241] 1天前
匿名网友 选择了C
[92.***.***.205] 1天前
匿名网友 选择了B
[70.***.***.191] 1天前
匿名网友 选择了D
[231.***.***.107] 1天前
匿名网友 选择了B
[123.***.***.149] 1天前
匿名网友 选择了A
[26.***.***.38] 1天前
匿名网友 选择了D
[18.***.***.75] 1天前
匿名网友 选择了B
[24.***.***.57] 1天前
匿名网友 选择了D
[137.***.***.73] 1天前
匿名网友 选择了D
[129.***.***.181] 1天前
匿名网友 选择了C
[194.***.***.129] 1天前
匿名网友 选择了A
[202.***.***.253] 1天前
匿名网友 选择了D
[7.***.***.210] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“编译运行下面的程序,结果是什么?()publicclassA…”相关的问题
第1题

分析下面的程序,写出程序的执行结果 public class Test { public static void main(String[] args) { final Person p = new Person("张三", 23); p.setName("李四"); p.setAge(24); System.out.println(p); } } class Person { private String name; private int age; public Person() { super(); } public Person(String name, int age) { super(); this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "我的姓名是:" + name + ",我的年龄是:" + age ; } }

点击查看答案
第2题
1、下列程序运行结果是( ) public class Demo { public static void main(String[] args) { Object obj=new Father(){ public void show(){ System.out.println("helloworld"); } }; obj.show(); } } class Father{ public void show(){ System.out.println("hello father"); } }

A、A.hello father

B、B.helloworld

C、C.无结果

D、D.程序编译报错

点击查看答案
第3题
下面程序段中,说法正确的是( ) class location{ public : int GetX(); }; class rectangle:private location { public: int GetW(); };

A、类rectangle私有派生类 location

B、类rectangle中的public成员在类 location中是私有的类

C、location中的public成员在类 rectangle中是不可访问的

D、viod f( ) { Rectangle r; int X=r .GetX( ); } 其中int X = r .GetX( );是非法语句

点击查看答案
第4题
class Test { public static void main(String[] args) { int a = 3; int b = 6; System.out.print(a==b); System.out.print(a<b); system.out.print(a!="b);" system.out.print(a> =b); } }

A、false false true false

B、false false true true

C、false true true false

D、true false false true

点击查看答案
第5题
下面程序运行的结果是: public struct myPoint { public int X, Y; public myPoint(int x, int y) { X = x; Y = y; } public myPoint(int x) : this(x, default(int)) { X = x; } public void show() { Console.Write("x={0},y={1}", X, Y); } } class testA { static void Main() { myPoint p1 = new myPoint(2); myPoint p2 = new myPoint(1, 2); p1 = p2; p1.Y = 10; p1.show(); p2.show(); } }
点击查看答案
第6题
指出下列程序中错误所在的行号________。 1 public class Main { 2 public static void main(string[] args) { 3 double i = 50.0; 4 double k = i + 50.0; 5 double j = k + 1; 6 System.out.println("j is "+ j + " and k is " + k); 7 } 8 }
点击查看答案
第7题
下面程序的运行结果是( )。 public static void main(String[] args) { int x=30; int[] numbers=new int[x]; x=60; System.out.println(numbers.length); }

A、60

B、20

C、30

D、50

点击查看答案
第8题
编译并运行下述程序段的结果是 public class Test{ public static void main(String argv[]){ int[] count = new int[4]; System.out.println(count[4]); } }

A、编译错误

B、运行错误

C、输出0

D、输出null

点击查看答案
第9题
return语句()。

A、不能用来返回对象

B、只可以返回数值

C、方法都必须含有

D、一个方法中可以有多个

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

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

简答题官方微信公众号

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

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

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