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;

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;

相关考题:

_____ time, he’ll make a fist-class tennis player. A、Having givenB、To giveC、GivingD、Given

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

Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()() A.B.C.D.E.F.

Click the Exhibit button. 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.

Given:Which two, inserted at line 11, will allow the code to compile?() A.public class MinMax? {B.public class MinMax? extends Number {C.public class MinMaxN extends Object {D.public class MinMaxN extends Number {E.public class MinMax? extends Object {F.public class MinMaxN extends Integer {

Given:Which statement is true about the class of an object that can reference the variable base? () A.It can be any class.B.No class has access to base.C.The class must belong to the geometry package.D.The class must be a subclass of the class Hypotenuse.

有如下程序: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

下面程序输出的结果为 #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” 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

设有以下定义和程序:includeclassA1{public:void show1(){ cout 设有以下定义和程序: #include<iostream.h> classA1 { public: void show1() { cout<<"classA1”<<end1; } }; classA2:public A1 { public: void show2() { cout<<"classA2"<<end1; } }; class A3:protected A2 { public: voidshow3() { cout<<"class A1”<<end1; } }; void main() { A1obj1; A2obj2; A3obj3; } 则以下不合语法的调用语句是A.obj1.show1();B.obj2.show1();C.obj3.show1();D.obj2.show2();

下面程序段的输出结果为 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.编译不通过

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

Which two statements are true about the hashCode method?()A、 The hashCode method for a given class can be used to test for object equality and object inequality for that class.B、 The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.D、 The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.E、 The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

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.

单选题Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()A  The code runs with no output.B  Compilation fails.C  An exception is thrown at runtime.D  ClassC is displayed.

多选题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;

单选题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;

多选题现有:  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;

单选题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?()A1B2CCompilation fails.DThe code runs with no output.EAn exception is thrown at runtime.

单选题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.

多选题Which two statements are true about the hashCode method?()AThe hashCode method for a given class can be used to test for object equality and object inequality for that class.BThe hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.CThe hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.DThe only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.EThe hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

单选题GPRS服务类型有CLASS A、CLASS B、CLASS C三种:()在上网的时候会将电话功能屏蔽,当有电话进来的时候自动切断网络;()可以同时使用网络和电话功能;()则是单纯的网络应用, 不提供电话功能。ACLASSB;CLASSA;CLASSCBCLASSA;CLASSB;CLASSCCCLASSC;CLASSB;CLASSADCLASSC;CLASSA;CLASSB