题目内容 (请给出正确答案)
[主观题]

对于下例代码,下面叙述正确的是()。 class Person { Person(int m){ } } class Student extends Person { }

A、可以用Person类的无参数构造方法创建对象:new Person()。

B、可以用Student类的无参数构造方法创建对象:new Student()。

C、代码无法通过编译。

D、Person类不能创建对象。

提问人:网友sangjiabei 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“对于下例代码,下面叙述正确的是()。 class Perso…”相关的问题
第1题
下列语句输出的结果是________。 class Person: def getInfo(self): return "Person" def printPerson(self): print(self.getInfo()) class Student(Person): def getInfo(self): return "Student" Person().printPerson() Student().printPerson()

A、Person Student

B、Person Person

C、Student Student

D、Student Person

点击查看答案
第2题
For a company concentrating on final assembly, adding retail and distribution into it's value chain will require:

A、backward integration.

B、forward integration.

C、taper integration.

D、related diversification.

E、unrelated diversification.

点击查看答案
第3题
对于下列代码,叙述正确的是( )。 interface Com{ int MAX=100; public void stop(); protected void start(); abstract void pause(); }

A、int MAX=100; 会导致编译出错。

B、public void stop(); 会导致编译出错。

C、protected void start(); 会导致编译出错。

D、abstract void pause(); 会导致编译出错。

点击查看答案
第4题
下面程序的运行结果是( )。class Animal{ public Animal(){ System.out.println("I'm an animal."); } } class Bird extends Animal{ public Bird(){ System.out.println("I'm a bird."); } } public class AnimalTest{ public static void main(String[] args) { Bird b = new Bird(); } }

A、编译错误

B、无输出结果

C、I'm a bird.

D、I'm an animal. I'm a bird.

点击查看答案
第5题
class Person { private int a; public int change(int m){ return m; } } public class Teacher extends Person { public int b; public static void main(String arg[]){ Person p = new Person(); Teacher t = new Teacher(); int i; // point x } } Which are syntactically valid statement at // point x?

A、i = m;

B、i = b;

C、i = p.a;

D、i = p.change(30);

点击查看答案
第6题
class Computation extends Thread {

private int num;

private boolean isComplete;

private int result;

public Computation(int num) { this.num = num; }

public synchronized void run() {

result = num * 2;

isComplete = true;

notify();

}

public synchronized int getResult() {

while (!isComplete) {

try {

wait();

} catch (InterruptedException e) { }

}

return result;

}

public static void main(String[] args) {

Computation[] computations = new Computation [4];

for (int i = 0; i< computations.length; i++) {  computations[i] = new Computation(i);  computations[i] .start();  }  for (Computation c : computations)  System.out.print(c.getResult() +“ “);  }  }  What is the result?()

A.  The code will deadlock.

B.  The code may run with no output.

C.  An exception is thrown at runtime.

D.  The code may run with output “0 6”.

E.  The code may run with output “2 0 6 4‟.

F .  The code may ruin with output “0 2 4 6”.

点击查看答案
第7题
【单选题】在下列C# 代码中,( )是类Teacher 的属性。 public class Teacher{ int age=13; public string Name{ get{return name;} set{name=value;} } public void SaySomething(){//…} }

A、Name

B、name

C、age

D、SaySomething

点击查看答案
第8题
设有以下定义: #include<iostream.h> class A1 { public: void show1() { cout<<"class }; a2:public a1 { public: void a3:protected a2 main() obj1; obj2; a3 obj3; } 以下不合法的调用语句是(> A、obj1.show1();

B、obj2.show1();

C、obj3.show1();

D、obj2.show2();

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

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

简答题官方微信公众号

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

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

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