下列代码的输出结果是( )。class parent { void printme() {System.out.println("parent"); } }cl

题目

下列代码的输出结果是( )。

class parent

{

void printme()

{

System.out.println("parent");

}

}

class child extends parent

{

void printme()

{

System. out.println("child");

}

void printall()

{

super, printme();

this.printme();

printme();

}

}

public class test

{

public static void main(String args[])

{

child myc=new child();

myc.printall();

}

}

A.import java.awt.*;

B.import java.applet.applet;

C.import java.io.*;

D.import java, awt.graphics;

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

11、下面代码的输出结果是x = 12.34;print(type(x))

A.<class 'bool'>

B.<class 'complex'>

C.<class 'float'>

D.<class 'int'>


A

第2题:

下面代码的输出结果是: x = 12.34 print(type(x))

A.<class 'float'>

B.<class 'complex'>

C.<class 'bool'>

D.<class 'int'>


127.0

第3题:

下面代码的输出结果是() x = 12.34 print(type(x))

A.<class ‘int’>

B.<class ‘float’>

C.<class ‘bool’>

D.<class ‘complex’>


127.0

第4题:

下面代码的输出结果是‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‫‪‪‪‪‪‪‫ x = 12.34 print(type(x))

A.<class 'complex'>

B.<class 'float'>

C.<class 'int'>

D.<class 'bool'>


127.0

第5题:

10、变量a表示一个<a>标签,不考虑异常,获取<a>标签爷爷节点名字的代码可能是哪个?

A.soup.a.name

B.a.parent(2).name

C.a.parent.parent.name

D.a.parents.name


s->next=p->next; p->next->prior=s; s->prior=p; p->next=s;

第6题:

下面代码的输出结果是x = 12.34;print(type(x))

A.<class 'bool'>

B.<class 'complex'>

C.<class 'float'>

D.<class 'int'>


127.0

第7题:

有如下程序: include using namespace std; class PARENT { public: PARENT() { cout

有如下程序:

include <iostream>

using namespace std;

class PARENT

{

public:

PARENT() { cout <<"PARENT"; }

};

class SON : public PARENT

{

public:

SON() {cout << "SON"; }

};

int main()

{

SON son;

PARENT *p;

p = &son;

return 0;

}

执行上面程序的输出是______。


正确答案:PARENTSON
PARENTSON 解析:此题考查的是派生类的构造。主函数开始在定义SON类的对象son时,会先执行PARENT类的构造函数再执行SON类的构造函数,输出 “PAKENTSON”;接下来的语句定义PARENT和让指针p指向son对象,都并未创建任何对象,所以不会调用构造函数。故最终的输出结果是:PARENTSON。

第8题:

调用对象方法的格式正确的是()。

A.Object.Method

B.MethodObject

C.Parent.Object.Method

D.Parent.Method


正确答案:C

第9题:

有如下程序:

#include

using namespace std;

class PARENT

{

public:

PARENT(){cout<<"PARENT";}

};

class SON:public PARENT

{

public:

SON(){cout<<"SON";}

};

int main()

{

SON son;

PARENT *p;

p = &son;

return 0;

}

执行上面程序的输出是 【 12 】 。


正确答案: