public class Employee extends Info implements Data { public void load() { /*do something*/ } }
public class Employee implements Info extends Data { public void load() { /*do something*/ } }
public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
第1题:
下面程序输出的结果是【 】。
include <iostream>
using namespacc std;
class A {
public:
void show(){tout<<"A!";}
};
class B: public A{
public:
virtual void show(){cout<<"B!";}
};
class C: public B{
public:
virtual void show(){cout<<"C!";}
};
void show_info(A *i){i->show();}
void main(){
A ia;B ib;C ic;show_info(&ia); show_info(&ib);show_info(&ic);
}
第2题:
下列程序片段中,能通过编译的是( )。
A.public abstract class Animal{public void speak( );}
B.public abstract class Animal{public void speak( ){};}
C.public class Animal{pubilc abstract void speak( );}
D.public abstract class Animal{pubile abstract void speak( ){};}
第3题:
下列程序片段中,能通过编译的是
A.public abstract class Animal{ public void speak();}
B.public abstract class Animal{ public void speak(){}}
C.public class Animal{ public abstract void speak();}
D.public abstract class Animal{ public abstract void speak(){}}
第4题:
下列哪个类声明是正确的? ( )
A.abstract class G2 extends superClass1,superClass2{...}
B.abstract public class classmates{...}
C.public final class NewClass extends superClass implemnets Interface1{...}
D.public abstract class String{...}
第5题:
下面程序输出的结果是【 】。
include <iostream>
using namespace std;
class A {
public:
virtual void show() {cout<<"A!";
};
class B: public A {
public:
void show() {cout << "B!";}
};
class C: public B{
public:
void show(){cout << "C!";}
};
void show_info(A &i) {i. show();}
void main() {
A ia; B ib; C ic; show_info(ia);show_info(ib); show_info(ic); }
第6题:
A.
B.
C.
D.
E.
F.
第7题:
写出程序的输出结果
public abstract class A
{
public A()
{
Console.WriteLine('A');
}
public virtual void Fun()
{
Console.WriteLine("A.Fun()");
}
}
public class B: A
{
public B()
{
Console.WriteLine('B');
}
public new void Fun()
{
Console.WriteLine("B.Fun()");
}
public static void Main()
{
A a = new B();
a.Fun();
}
}
第8题:
下列程序打包到example包,main方法调用线程类输出0~9这10个数,请填写横线处的内容。
注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。
______
interface MyInterface
{
public abstract void print(int n);
}
class Mythread extends Thread ______ MyInterface
{
public void run()
{
for(int i = 0; i < 10; i++)
this.print(i);
}
public void print(int n)
{
System.out.print(n +" ");
}
}
public class Example1_6
{
public static void main(String argv[])
{
Mythread th = new Mythread();
______
}
}
第9题:
下面的代码中有什么错误吗?_______
using System;
class A
{
public virtual void F(){
Console.WriteLine("A.F");
}
}
abstract class B:A
{
public abstract override void F();
第10题:
下列程序片段中,能通过编译的是( )。
A.public abstract class Animal{ public void speak;}
B.public abstract class Animal{ public void speak{);}
C.public class Animal{ pubilc abstract void speak;}
D.public abstract class Animal{ pubile abstract void speak{};}