网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
多选题
现有: class ClassA {} class ClassB extends ClassA {) class ClassC extends ClassA {) 以及: ClassA p0=new ClassA(); ClassB pl=new ClassB(); ClassC p2=new ClassC(); ClassA p3=new ClassB(); ClassA p4=new ClassC(); 下列哪些是正确的?()
A
p0=pl;
B
p1 =p2;
C
p2=p4;
D
p2 = (ClassC)pl;
E
p1 = (ClassB)p3;
F
p2 = (Classc)p4;
参考答案
参考解析
解析:
暂无解析
更多 “多选题现有: class ClassA {} class ClassB extends ClassA {) class ClassC extends ClassA {) 以及: ClassA p0=new ClassA(); ClassB pl=new ClassB(); ClassC p2=new ClassC(); ClassA p3=new ClassB(); ClassA p4=new ClassC(); 下列哪些是正确的?()Ap0=pl;Bp1 =p2;Cp2=p4;Dp2 = (ClassC)pl;Ep1 = (ClassB)p3;Fp2 = (Classc)p4;” 相关考题
考题
package test;class Target{public String name=hello;}What can directly access and change the value of the variable name?()
A.any classB.only the Target classC.any class in the test packageD.any class that extends Target
考题
Whatproducesacompilererror?()
A.classA{publicA(intx){}}B.classA{}classBextendsA{B(){}}C.classA{A(){}}classB{publicB(){}}D.classZ{publicZ(int){}}classAextendsZ{}
考题
classA{A(){}}classBextendsA{}Whichtwostatementsaretrue?()
A.ClassB’sconstructorispublic.B.ClassB’sconstructorhasnoarguments.C.ClassB’sconstructorincludesacalltothis().D.ClassB’sconstructorincludesacalltosuper().
考题
Given:What can directly access and change the value of the variable name?()
A. any classB. only the Target classC. any class in the test packageD. any class that extends Target
考题
有如下程序:includeusing namespace std;classA{public:A(){cout
有如下程序: #include<iostream> using namespace std; classA { public: A(){cout<<"A";} }; class B{public:B(){cout<<"B";}}; class C:public A { B b; public: C(){cout<<"C";} }; int main(){C obj;return 0;} 执行后的输出结果是( )A.ABCB.BACC.ACBD.CBA
考题
下面程序段的输出结果为 package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); b.go(10); System.out.println("x="+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x=20C.x=6D.编译不通过
考题
下面程序输出的结果为 #include"iostream.h" class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASSB"<<endl;} ~B() {} }; void main() { A * p; p=new B; B *q; q=new B; }A.CLASS A CLASS BB.CLASS A CLASS B CLASS BC.CLASS A CLASS B CLASS A CLASS BD.CLASS A CLASS B CLASS B CLASS B
考题
下面程序段的输出结果为( )。 package test; public class ClassA { int x=20: static int y=6; public static void main(String args[]) { ClassB b=new ClassB; go(10); System.out.println("x="+b.x); } } class ClassB { int X; void go(int y) { ClassA a=new ClassA; x=a.Y ; } }A.x=10B.x=20C.x=6D.编译不通过
考题
下面程序输出的结果为( )。 #include"iostream.h" classA {public: A(){cOUt"CLASSA"endl;} ~A(){}}; ClaSSB:publicA {public: B(){cout"CLASSB"endl;} ~B(){}}; voidmain() {A*P; P=newB: B*q: q=newB;}A.CLASSAB.CLASSA CLASSBCLASSB CLASSBC.CLASSAD.CLASSA CLASSBCLASSB CLASSACLASSB CLASSBCLASSB
考题
下面程序输出的结果为 #include"iostream.h” class A { public: A(){cout<<"CLASSA"<<endl;} ~A() {} }; class B:public A { public: B(){cout<<"CLASS B"<<endl;} ~B(){} }; void main() { A*p; p=new B;A.CLASS A CLASS B CLASS B CLASS BB.CLASS A CLASS B CLASS A CLASS BC.CLASS A CLASS B CLASS BD.CLASS A CLASS B
考题
下面程序段的输出结果为 package test; public class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println(”x=”+b.x); } } class Class B { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x=20C.x=6D.编译不通过
考题
有以下源程序: package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB(); b.go(10); System.out.println("x="+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } } 上述源程序文件的运行结果为( )。A.x=10B.x=20C.x=6D.编译不通过
考题
下面程序输出的结果为( )。 includeiostream.hclassA{public: A(){cOUtiostream.hclassA{public:A(){cOUtCLASSAendl;}~A(){}};ClaSSB:publicA{public:B(){coutCLASSBendl;}~B(){}};voidmain(){A*P;P=newB:B*q:q=newB;}A.CLASSBB.CLASSA CLASSB CLASSBC.CLASSA CLASSB CLASSA CLASSBD.CLASSA CLASSB CLASSB CLASSB
考题
下面程序段的输出结果为 package test; public class Class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println("x"+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }A.x=10B.x-20C.x=6D.编译不通过
考题
10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?() A、 StackOverflowErrorB、 NullPointerExceptionC、 NumberFormatExceptionD、 IllegalArgumentExceptionE、 ExceptionlnlnitializerError
考题
GPRS服务类型有CLASS A、CLASS B、CLASS C三种:()在上网的时候会将电话功能屏蔽,当有电话进来的时候自动切断网络;()可以同时使用网络和电话功能;()则是单纯的网络应用, 不提供电话功能。A、CLASSB;CLASSA;CLASSCB、CLASSA;CLASSB;CLASSCC、CLASSC;CLASSB;CLASSAD、CLASSC;CLASSA;CLASSB
考题
public class ClassA{ public int getValue(){ int value=0; boolean setting=true; String title="Hello"; if(value||(setting title=="Hello")){return 1;} if(value==1title.equals("Hello")){return 2;} } } And: ClassA a=new ClassA(); a.getValue(); What is the result?()A、1B、2C、Compilation fails.D、The code runs with no output.E、An exception is thrown at runtime.
考题
package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()A、any classB、only the Target classC、any class in the test packageD、any class that extends Target
考题
Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()A、p0 = p1;B、p1 = p2;C、p2 = p4;D、p2 = (ClassC)p1;E、p1 = (ClassB)p3;F、p2 = (ClassC)p4;
考题
现有: class ClassA {} class ClassB extends ClassA {) class ClassC extends ClassA {) 以及: ClassA p0=new ClassA(); ClassB pl=new ClassB(); ClassC p2=new ClassC(); ClassA p3=new ClassB(); ClassA p4=new ClassC(); 下列哪些是正确的?()A、p0=pl;B、p1 =p2;C、p2=p4;D、p2 = (ClassC)pl;E、p1 = (ClassB)p3;F、p2 = (Classc)p4;
考题
单选题class ClassA { public int numberOfinstances; protected ClassA(int numberOfinstances) { this.numberOflnstances = numberOfinstances; } } public class ExtendedA extends ClassA { private ExtendedA(int numberOfinstances) { super(numberOflnstances); } public static void main(String[] args) { ExtendedA ext = new ExtendedA(420); System.out.print(ext.numberOflnstances); } } Which is true?()A
420 is the output.B
An exception is thrown at runtime.C
All constructors must be declared public.D
Constructors CANNOT use the private modifier.E
Constructors CANNOT use the protected modifier.
考题
单选题10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()A
StackOverflowErrorB
NullPointerExceptionC
NumberFormatExceptionD
IllegalArgumentExceptionE
ExceptionlnlnitializerError
考题
多选题Given: class ClassA {} class ClassB extends ClassA {} class ClassC extends ClassA {} and: ClassA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3 = new ClassB(); ClassA p4 = new ClassC(); Which three are valid?()Ap0 = p1;Bp1 = p2;Cp2 = p4;Dp2 = (ClassC)p1;Ep1 = (ClassB)p3;Fp2 = (ClassC)p4;
考题
单选题10. public class ClassA { 11. public void methodA() { 12. ClassB classB = new ClassB(); 13. classB.getValue(); 14. } 15. } And: 20. class ClassB { 21. public ClassC classC; 22. 23. public String getValue() { 24. return classC.getValue(); 25. } 26. } And: 30. class ClassC { 31. public String value; 32. 33. public String getValue() { 34. value = “ClassB”; 35. return value; 36. } 37. } Given: ClassA a = new ClassA(); a.methodA(); What is the result?()A
Compilation fails.B
ClassC is displayed.C
The code runs with no output.D
An exception is thrown at runtime.
考题
单选题package test; class Target { public String name = “hello”; } What can directly access and change the value of the variable name?()A
any classB
only the Target classC
any class in the test packageD
any class that extends Target
考题
单选题GPRS服务类型有CLASS A、CLASS B、CLASS C三种:()在上网的时候会将电话功能屏蔽,当有电话进来的时候自动切断网络;()可以同时使用网络和电话功能;()则是单纯的网络应用, 不提供电话功能。A
CLASSB;CLASSA;CLASSCB
CLASSA;CLASSB;CLASSCC
CLASSC;CLASSB;CLASSAD
CLASSC;CLASSA;CLASSB
热门标签
最新试卷