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

classA{publicStringtoString(){return4”;}}classBextendsA{8.publicStringtoString(){returnsuper.toString()+3”;}}publicclassTest{publicstaticvoidmain(Stringargs){System.out.printIn(newB());}}Whatistheresult?()

A.Compilationsucceedsand4isprinted.

B.Compilationsucceedsand43isprinted.

C.Anerroronline9causescompilationtofail.

D.Anerroronline14causescompilationtofail.

E.Compilationsucceedsbutanexceptionisthrownatline9.

提问人:网友yangtuzi2000 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有3位网友选择 B,占比33.33%
  • · 有2位网友选择 D,占比22.22%
  • · 有2位网友选择 A,占比22.22%
  • · 有2位网友选择 C,占比22.22%
匿名网友 选择了D
[64.***.***.189] 1天前
匿名网友 选择了A
[35.***.***.47] 1天前
匿名网友 选择了B
[230.***.***.0] 1天前
匿名网友 选择了C
[118.***.***.45] 1天前
匿名网友 选择了A
[58.***.***.71] 1天前
匿名网友 选择了D
[119.***.***.212] 1天前
匿名网友 选择了C
[86.***.***.241] 1天前
匿名网友 选择了B
[163.***.***.17] 1天前
匿名网友 选择了B
[91.***.***.170] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“classA{publicStringtoString(){…”相关的问题
第1题
补全toString方法,使其内容为“width=***,height=***”。 public class Rectangle{ private double width; private double height; public Rectangle(){} public Rectangle(double a, double b) { width=a;height=b; } public String toString(){ 代码 } }
点击查看答案
第2题
public class BMI { public String toString(double weight, double height){ double b = weight/(height*height); if(b < 20) return "偏瘦"; else if(b < 25) return "正常"; else if(b < 30) return "偏胖"; else if(b < 35) return "肥胖"; else if(b < 40) return "重度肥胖"; else return "极度肥胖"; } } 输入55.0,1.75,返回结果是()。
点击查看答案
第3题
[图] 该程序的运行结果是:...

该程序的运行结果是:

点击查看答案
第4题
以下程序运行结果是 public class Pvf{   static boolean Paddy;   public static void main(String argv[]){   System.out.println(Paddy);   }   }

A、编译时错误

B、false

C、true

D、null

点击查看答案
第5题
阅读以下说明和Java代码,将应填入____处的语句或语句成分写在答题纸的对应栏内。

【说明】某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后选出排名前30%的学生。【Java代码】

点击查看答案
第6题
阅读以下说明和Java程序,将应填入(n)处的字句写在对应栏内

[说明]

以下程序的功能时三角形、矩形和正方形的面积输出。

程序由5个类组成:areatest是主类,类Triangle,Rectangle和Square分别表示三角形、矩形和正方形,抽象类Figure提供了一个计算面积的抽象方法。

[Java程序]

public class areatest {

public static viod main(string args[]){

Figure[]Figures={

New triangle(2,3,3),new rectangle(5,8),new square(5)

};

for(int i=0; i<Figures.length;i++){

system.out.println(Figures+"area="+Figures.getarea());

}

}

}

public abstract class figure {

public abstract double getarea();

}

public class rectangle extends (1) {

double height;

double width;

public rectangle (double height,double width){

this.height=height;

this.width=width;

}

public string tostring(){

return"rectangle:height="+height+",width="+width+":";

}

public double getarea(){

return (2)

}

}

public class square exends (3)

{

public square(double width){

(4);

}

public string tostring(){

return"square:width="+width":";

}

}

public class triangle entends (5)

{

double la;

double lb;

double lc;

public triangle(double la,double lb,double lc){

this.la=la;this.lb=lb;this.lc=lc;

}

public string tostring()(

return"triangle:sides="+la+","+lb+","+lc+":";

}

public double get area(){

double s=(la+lb+lc)/2.0;

return math.sqrt(s*(s-la)*(s-lb)*(s-lc));

}

}

点击查看答案
第7题
以文本形式(非附件)提交GameAPI.java的代码,代码中应该设计5个宝箱问题
点击查看答案
第8题

下面程序运行的结果是() class test { static void Main(string[] args) { Queue Q = new Queue(); Stack S = new Stack(); for (int i = 1; i <= 10; i++) q.enqueue(i); for (int i="1;i&lt;=10;i++)" if (i%2="=0)" s.push(q.dequeue()); s.count; console.write("{0},", s.pop()); } a、2,4,6,8,10, b、10,9,8, c、9,7,5,3,1, d、5,4,3 答案: d 2、下面程序运行的结果是() public test { string[] names="{" "a", "b", "c", "d","e" }; ienumerator> GetEnumerator() { for (int i = 0; i < 5; i++) yield return names[2*i+1]; } static void Main(string[] args) { test ts = new test(); foreach (string s in ts) Console.Write("{0},",s); } }

A、a,b,c,d,e

B、0,1,3

C、a,c,e

D、b,d

点击查看答案
第9题

阅读下面的程序 public class Person { public string Name { get; set; } public Person( string name) { Name = name; } public override string ToString() { return Name; } static void Main(string[] args) { int[] A1 = new int[] { 1, 2 }; int[] A2 = (int[])A1.Clone(); int[] A3 = new int[2]; Person[] p1 = new Person[] { new Person("A"), new Person("B") }; Person[] p2 = (Person[])p1.Clone(); Person[] p3 = new Person[2]; Array.Copy(p1, p3, 1); Array.Copy(A1, A3, 1); p2[0].Name = "C"; A2[0] = 3; Console.WriteLine("{0},{1},{2}", p1[0], p2[0],p3[0]); Console.WriteLine("{0},{1},{2}", A1[0], A2[0], A3[0]); } } 程序运行的结果是:

A、A,B,C 1,2,3

B、C,B,C 1,2,1

C、C,C,C 1,1,1

D、C,C,C 1,3,1

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

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

简答题官方微信公众号

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

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

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