网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
在下列程序的划线处应填入的语句是 ( ) class Person { private int a; } public class Man extends Person { public int b public static void main(String arg[]) { Person P=new Person(); Man t=new Man(); int i; ______ } }
A.i=w;
B.i=b;
C.i=p.a;
D.i=t,b;
参考答案
更多 “ 在下列程序的划线处应填入的语句是 ( ) class Person { private int a; } public class Man extends Person { public int b public static void main(String arg[]) { Person P=new Person(); Man t=new Man(); int i; ______ } }A.i=w;B.i=b;C.i=p.a;D.i=t,b; ” 相关考题
考题
为使下列代码正常运行,应该在下划线处填入的选项是abstract class Person{public Person(String n)!name=n;}public____String getDescription();public String getName(){return name;}private String name;}A.staticB.privateC.abstractD.final
考题
能将程序补充完整的选项是( )。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; ______ }} B.A.i=mB.i=bC. i=p.aD.i=p. change(50)
考题
能将程序补充完整的选项是______。 class Person{ private int a; phblic 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; ______; } }A.i=mB.i=bC.i=p.aD.i=p.change(50)
考题
为完成下面的程序,应在划线处填入的语句是includeusingnamespace std;class Base{pri
为完成下面的程序,应在划线处填入的语句是 #include<iostream> using namespace std; class Base { private: int x; public: Base (int i) { x=i; } ~Base(){} }; class Derived:public Base { public: ______________//完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.void Derived (int i):Base(i){}D.Derived(int i){Base(i);}
考题
根据下面的程序,可以在主程序中使用的合法语句是( )。 include using namesp
根据下面的程序,可以在主程序中使用的合法语句是( )。 #include <iostream> using namespace std; class Person{ int age; public: void SetAge(int x){age=x;} void ShowAge(){cout<<"the Person's age is" <<age;} }; class Student:private Person{ public:int study_code; }; void main(){ Student wangqiang; wangqiang.study_code=23; }A.wangqiang.age=231B.wangqiang.Setage(23)C.wangqiang.ShowAge()D.wangqiang.study_code=12
考题
在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }}A.i=w;B.i=bC.i=p.a;D.i=t.b;
考题
在下列程序的划线处应填入的语句是 class Pemon { pnvate int a; } public class Man extends Person { public int b; public static void main(String arg[ ] ) { Person p = new Person( ); Man t = new Man( ); int i; ________ } }A.i = w;B.i = b;C.i = p.a;D.i = t.b;
考题
下列程序中需要清理动态分配的数组,划线处应有的语句是_______。 include class pers
下列程序中需要清理动态分配的数组,划线处应有的语句是_______。include<iostream.h>class person{int age,tall;public:person( ){age=0;tall=40;cout<<"A baby is born."<<endl;}person(int i){age=i;tall=40;cout<<"A old person."<<endl;}person(int i,int j){age=i;tall=j;cout<<"a old person with tall."<<endl;)~person( ){cout<<"person dead."<<endl;}void show( ){cout<<"age="<<age<<",tall="<<tall<<endl;}};void main( ){person*ptr;ptr=new person[3];ptr[0]=person( );ptr[1]=person(18);ptr[2]=person(20,120);for(int i=0;i<3;i++)ptr[i].show( );______}
考题
为完成下面的程序,应在划线处填入的语句是()。includeusingnamespacestd;classBase{pr
为完成下面的程序,应在划线处填入的语句是( )。 #include <iostream> using namespace std; class Base { private: int x; public: Base(int i) { x=i; } ~Base(){} }; class Derived : public Base { public: _______________ //完成类Derive构造函数的定义 }; int main() { Derived Obj; return 0; }A.Derived(int i):Base(i){}B.Derived(){}C.voidDerived(int i):Base(0){}D.Derived(int i){Base(i);}
考题
在下列程序的划线处应填入的语句是( )。 class Person { private int a: } public class Man extends Person{ public int b; public static void main(String arg []){ Person p=newPerson(); Man t=new Man(); int i; _________________ } }A.i=w;B.i=b;C.i=P.a;D.i=t.b;
考题
下列程序编译错误,是由于划线处缺少某个语句,该语句是______。 include class A { pr
下列程序编译错误,是由于划线处缺少某个语句,该语句是______。include<iostream.h>class A{private:int numl;public:A( ):numl(0){}A(int i):numl(i){}};class B{private:int num2;public:B( ):num2(0){}B(int i):num2(i){}int my_math(A obj1, B obj2);};int B::my_math(A obj1,B obj2){return(obj1.numl+obj2.num2);}void main(void){A objl(4);B obj,obj2(5);cout<<"obj1+obj2:"<<obj.my_math(obj1,obj2);}
考题
( 30 )在程序的下划线处应填入的选项是public class Test _________{public static void main(String args[]){Test t = new Test();Thread tt = new Thread(t);tt.start();}public void run(){for(int i=0;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable
考题
( 31 ) 为了支持压栈线程与弹栈线程之间的交互与同步 , 在程序的下划线处依次填入的语句是public class IntStack{private int idx=0;private int[] data=new int[8];public void push(int i){data[idx]=i;idx++;}__________......}A ) synchronized()notify()B ) synchronized()this.wait()C ) synchronized()this.notify()D ) synchronized()sleep()
考题
Which three demonstrate an “is a” relationship?() A、 public class X { } public class Y extends X { }B、 public interface Shape { } public interface Rectangle extends Shape{ }C、 public interface Color { } public class Shape { private Color color; }D、 public interface Species { } public class Animal { private Species species; }E、 public class Person { } public class Employee { public Employee(Person person) { }F、 interface Component { } class Container implements Component { private Component[] children; }
考题
对于下列代码: 1) class Person { 2} public void printValue(int i, int j) {//... } 3} public void printValue(int i){//... } 4} } 5) public class Teacher extends Person { 6} public void printValue( ) {//... } 7} public void printValue(int i) {//...} 8} public static void main(String args[]){ 9} Person t = new Teacher( ); 10} t.printValue(10); 11} } 第10行语句将调用哪行语句?()A、 line 2B、 line 3C、 line 6D、 line 7
考题
Which Man class properly represents the relationship "Man has a best friend who is a Dog"?()A、class Man extends Dog{}B、class Man implements Dog{}C、class Man{private BestFriend dog;}D、class Man{private Dog bestFriend;}E、class Man{private Dog;}F、class Man{private BestFriend;}
考题
Which the two demonstrate an “is a” relationship?()A、 public interface Person {} Public class Employee extends Person {}B、 public interface Shape {} public interface Rectangle extends Shape {}C、 public interface Color {} public class Shape { private Color color; }D、 public class Species {} public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;
考题
Which two demonstrate an “is a” relationship?() A、 public interface Person { } public class Employee extends Person { }B、 public interface Shape { } public class Employee extends Shape { }C、 public interface Color { } public class Employee extends Color { }D、 public class Species { } public class Animal (private Species species;)E、 interface Component { } Class Container implements Component ( Private Component[ ]children; )
考题
What produces a compiler error?() A、 class A { public A(int x) {} }B、 class A {} class B extends A { B() {} }C、 class A { A() {} } class B { public B() {} }D、 class Z { public Z(int) {} } class A extends Z {}
考题
public class Parent { int change() {…} } class Child extends Parent { } Which methods can be added into class Child?() A、 public int change(){}B、 int chang(int i){}C、 private int change(){}D、 abstract int chang(){}
考题
public abstract class Shape { private int x; private int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which two classes use the Shape class correctly?()A、 public class Circle implements Shape { private int radius; }B、 public abstract class Circle extends Shape { private int radius; }C、 public class Circle extends Shape { private int radius; public void draw(); }D、 public abstract class Circle implements Shape { private int radius; public void draw(); }E、 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }F、 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }
考题
Which Man clsss properly represents the relationship "Man has a best friend who is a Dog"?()A、class Man extends Dog { }B、class Man implements Dog { }C、class Man { private BestFriend dog; }D、class Man { private Dog bestFriend; }E、class Man { private Dog; }F、class Man { private BestFriend; }
考题
多选题Which are syntactically valid statement at// point x?() 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 } }Ai = m;Bi = b;Ci = p.a;Di = p.change(30);Ei = t.b.
考题
多选题Which three demonstrate an “is a” relationship?()Apublic class X { } public class Y extends X { }Bpublic interface Shape { } public interface Rectangle extends Shape{ }Cpublic interface Color { } public class Shape { private Color color; }Dpublic interface Species { } public class Animal { private Species species; }Epublic class Person { } public class Employee { public Employee(Person person) { }Finterface Component { } class Container implements Component { private Component[] children; }
考题
多选题public abstract class Shape { private int x; private int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which two classes use the Shape class correctly?()Apublic class Circle implements Shape { private int radius; }Bpublic abstract class Circle extends Shape { private int radius; }Cpublic class Circle extends Shape { private int radius; public void draw(); }Dpublic abstract class Circle implements Shape { private int radius; public void draw(); }Epublic class Circle extends Shape { private int radius;public void draw() {/* code here */} }Fpublic abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }
考题
多选题Which two demonstrate an “is a” relationship?()Apublic interface Person { } public class Employee extends Person { }Bpublic interface Shape { } public class Employee extends Shape { }Cpublic interface Color { } public class Employee extends Color { }Dpublic class Species { } public class Animal (private Species species;)Einterface Component { } Class Container implements Component ( Private Component[ ]children; )
考题
多选题Which the two demonstrate an “is a” relationship?()Apublic interface Person {} Public class Employee extends Person {}Bpublic interface Shape {} public interface Rectangle extends Shape {}Cpublic interface Color {} public class Shape { private Color color; }Dpublic class Species {} public class Animal { private Species species; }Einterface Component {} Class Container implements Component {private Component [] children;
考题
单选题对于下列代码: 1) class Person { 2} public void printValue(int i, int j) {//... } 3} public void printValue(int i){//... } 4} } 5) public class Teacher extends Person { 6} public void printValue( ) {//... } 7} public void printValue(int i) {//...} 8} public static void main(String args[]){ 9} Person t = new Teacher( ); 10} t.printValue(10); 11} } 第10行语句将调用哪行语句?()A
line 2B
line 3C
line 6D
line 7
热门标签
最新试卷