多选题public class Foo {  private int val;  public foo(int v) (val = v;)  }  public static void main (String [] args)  {  Foo a = new Foo (10);  Foo b = new Foo (10);  Foo c = a;  int d = 10;  double e = 10.0;  }  Which three logical expression evaluate to true?()A(a ==c)B(d ==e)C(b ==d)D(a ==b)E(b ==c)F(d ==10.0)

多选题
public class Foo {  private int val;  public foo(int v) (val = v;)  }  public static void main (String [] args)  {  Foo a = new Foo (10);  Foo b = new Foo (10);  Foo c = a;  int d = 10;  double e = 10.0;  }  Which three logical expression evaluate to true?()
A

(a ==c)

B

(d ==e)

C

(b ==d)

D

(a ==b)

E

(b ==c)

F

(d ==10.0)


参考解析

解析: 暂无解析

相关考题:

有如下类定义:class Foo{public:Foo(int v):value(v){} // ①~Foo(){} // ②private:Foo(){} // ③int value = 0; // ④};其中存在语法错误的行是A . ①B . ②C . ③D . ④

以下程序中,错误的行为①include ②class A③{④public:⑤int n=2;⑥A(int val){cout 以下程序中,错误的行为 ①#include < iostream.h > ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout << val<<end1;} ⑦ ~A( 0{}; ⑧}; ⑨void main( 0 ⑩{ (11) Aa(0); (12)A.⑤B.⑥C.⑦D.(11)

( 29 )有如下程序:#includeiostreamusing namespace std;class Part{public:Part(int x=0):val(x) {coutval;}~Part(){coutval;}private:int val;};class Whole{public:Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){coutval;}~Whole(){coutval;}private:Part p1,p2;int val;};int main(){Whole obj(1,2,3);return 0;}程序的输出结果是A ) 123321B ) 213312C ) 213D ) 123123

( 30 )有如下程序:#includeiostreamusing namespace std;class Base{public:Base(int x=0){coutx;}};class Derived:public Base{public:Derived(int x=0){coutx;}private:Base val;};int main(){Derived d(1);return 0;}程序的输出结果是A ) 0B ) 1C ) 01D ) 001

以下程序中,错误的行为 ① include ② class A ③ { ④ public: ⑤ int n=2; ⑥ A(int va 以下程序中,错误的行为① #include<iostream.h>② class A③ {④ public:⑤ int n=2;⑥ A(int val) {cout < < val < < endl;}⑦ ~A( ) {};⑧ };⑨ void main( )⑩ {(11) A a (0) ;(12) }A.⑤B.⑥C.⑦D.⑩

有如下程序: include using namespace std; class Part{ public: 有如下程序: #include <iostream> using namespace std; class Part{ public: Part(int x=0):val(x) { cout<<val; } ~Part() { cout<<val; } private: int val; }; class Whole { public: Whole(int x, int y, int z=0):p2(x),p1 (y),val(z) { cout<<val; } ~whole() { cout<<val; private: Part p1,p2; int val; }; int main() { Whole obj (1,2,3); return 0; }程序的输出结果是A.123321B.213312C.213D.123123

有如下程序:includeusing namespace std;class MyClass{public:MyClass(int x):val(x 有如下程序: #include<iostream> using namespace std; class MyClass{ public: MyClass(int x):val(x){} void Print()const{cout<<“const:val=”<<<val<<‘\’;} void Print(){cout<<“val=”<<val<<‘t’;} private: int va1; }; int main(){ consA.val=10 const:val=20B.const:val=10 const:val=20C.const:val=10 val=20D.val=10 val=20

Given:Which code, inserted at line 15, allows the class Sprite to compile?() A.Foo { public int bar() { return 1; }B.new Foo { public int bar() { return 1; }C.new Foo() { public int bar() { return 1; }D.new class Foo { public int bar() { return 1; }

在下面的类定义中,错误的语句是class Sample { public: Sample(int val); //①~Sample(): //②private: int a=2.5; //③Sample(); //④ };A.①②③④B.②C.③D.①②③

以下程序的输出结果是_____。 include class object {private:int val; public:objec 以下程序的输出结果是_____。include<iostream.h>class object{ private:int val;public:object( ) ;object(int i) ;~object( ) ;};object: :object( ){ val=0;cout < < "Default constructor for object" < < endl;}object: :object(int i){ val=i;cout < < "Constructor for object" < < val < < endl;}object: :~object( ){ cout < < "Destructor for object" < < val < < endl;}class container{ private:object one;object two;int data;public:container( ) ;container(int i,int j,int k) ;~container( ) ;};container: :container( ){ data=0;cout < < "Default constructor for container" < < endl;}container: :container(int i,int j,int k) :two(i) ,one(j){ data=k;cout < < "Constructor for container" < < endl;}container: :~container( ){ cout < < "Destructor for container" < < endl;}void main( ){ container anObj(5,6,10) ;}

有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x){co 有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是A.123321B.213312C.213D.123123

有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x) {c 有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x) {cout<<val;} ~Part(){cout<<val;} private: int val; }; class Whole{ public: Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){cout<<val;} ~Whole(){cout<<val;} private: Part p1,p2; int val; }; int main() Whole obj(1,2,3); return 0; } 程序的输出结果是( )。A.123321B.213312C.213D.123123

有如下类定义: class Foo { public: Foo(int v) : value(v) { } // ① ~Foo() { } // ② private: Foo() { } // ③ int value = 0; // ④ }; 其中存在语法错误的行是( )。A.①B.②C.⑧D.④

有如下类定义: class Foo { public: Foo(intv):value(v){} //① ~Foo(){} //② private: Foo(){} //③ int value=0; //④ }; 其中存在语法错误的行是( )。A.①B.②C.③D.④

有如下程序: #jnCludeiostream using namespaCe std; Class Part{ publiC: Part(int x=0):val(X){Coutval;} ~Part{Coutval;} private: int val; t }; Class Whole{ publiC: Whole(int x,int Y,int z=0):p2(x),pl(y),val(z){Coutval;} ~Whole{eoutval;} private: Part pl,p2; int val; }; int main { Whole obj(1,2,3); return 0; } 执行这个程序的输出结果是( )。A.123321B.213312C.213D.123123

有如下程序:includeusing namespace std;class MyClass{public: MyClass(int x):val( 有如下程序: #include<iostream> using namespace std; class MyClass{ public: MyClass(int x):val(x) {} void Print() const {cout<<"const:val="<<val<<'\t';} void Print() {cout<<"val="<<val<<'t';} private: int val; }; int main() const MyClass obj1(10); MyClass obi2(20); obj1.Print(); obj2.Print(); return 0; } 程序的输出结果是( )。A.val=10 const:val=20B.const:val=10 const:val=20C.const:val=10 val=20D.val=10 val=20

有如下程序: #include<iostream) using namespace std; classBase{ public: Base(int x=0){cout<<x;} }; Class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base Val; }; int main(){ Derived d(1); returnA.100B.000C.010D.001

以下程序中,错误的行为①include②class A③{④public:⑤int n=2;⑥A(int val){cout 以下程序中,错误的行为①#include<iostream.h> ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout<<val<<end1;} ⑦ ~A(){}; ⑧}; ⑨void main() ⑩{ (11) A a(0); (12)}A.⑤B.⑥C.⑦D.(11)

class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 int foo() { /* more code here */ }B、 void foo() { /* more code here */ }C、 public void foo() { /* more code here */ }D、 private void foo() { /* more code here */ }E、 protected void foo() { /* more code here */ }

class Foo {  private int x;  publicFoo(intx) {this.x=x; }  public void setX( int x) { this.x = x; }  public int getX() { return x; }  }   public class Gamma {  static Foo fooBar( Foo foo) {  foo = new Foo( 100);  return foo;  }  public static void main( String[] args) {  Foo foo = new Foo( 300);  System.out.print( foo.getX() + “-“);  Foo fooFoo = fooBar( foo);  System.out.print( foo.getX() + “-“);  System.out.print( fooFoo.getX() + “-“);  foo = fooBar( fooFoo);  System.out.print( foo.getX() + “-“);  System.out.prmt( fooFoo.getX());  }  }  What is the output of this program?()A、 300-100-100-100-100B、 300-300-100-100-100C、 300-300-300-100-100D、 300-300-300-300-100

class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()A、 public void foo() { }B、 public int foo() { return 3; }C、 public Two foo() { return this; }D、 public One foo() { return this; }E、 public Object foo() { return this; }

public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()  A、 i = 3B、 Compilation fails.C、 A ClassCastException is thrown at line 6.D、 A ClassCastException is thrown at line 7.

public class Foo {  public int a;  public Foo() { a = 3; }  public void addFive() { a += 5; }  }  and:  public class Bar extends Foo { public int a;  public Bar() { a = 8; }  public void addFive() { this.a +=5; }  }  invoked with:  Foo foo = new Bar();  foo.addFive();  System.out.println(”Value: “+ foo.a);  What is the result?() A、 Value: 3B、 Value: 8C、 Value: 13D、 Compilation fails.E、 The code runs with no output.F、 An exception is thrown at runtime.

单选题public class Foo {  public int a;  public Foo() { a = 3; }  public void addFive() { a += 5; }  }  and:  public class Bar extends Foo { public int a;  public Bar() { a = 8; }  public void addFive() { this.a +=5; }  }  invoked with:  Foo foo = new Bar();  foo.addFive();  System.out.println(”Value: “+ foo.a);  What is the result?()A Value: 3B Value: 8C Value: 13D Compilation fails.E The code runs with no output.F An exception is thrown at runtime.

单选题10. interface Foo { int bar(); }  11. public class Sprite {  12. public int fubar( Foo foo) { return foo.bar(); }  13. public void testFoo() {  14. fubar(  15. // insert code here  16.);  17. }  18. }  Which code, inserted at line 15, allows the class Sprite to compile?()A Foo { public int bar() { return 1; } }B new Foo { public int bar() { return 1; } }C newFoo() { public int bar(){return 1; } }D new class Foo { public int bar() { return 1; } }

多选题public class Foo {   private int val;   public foo(int v) (val = v;) }   public static void main (String args) {   Foo a = new Foo (10);   Foo b = new Foo (10);   Foo c = a;   int d = 10;   double e = 10.0;   }   Which three logical expression evaluate to true? ()A(a ==c)B(d ==e)C(b ==d)D(a ==b)E(b ==c)F(d ==10.0)

多选题public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()AMove the line 12 print statement into the foo() method.BChange line 7 to public synchronized void go() {.CChange the variable declaration on line 3 to private volatile int x;.DWrap the code inside the foo() method with a synchronized( this ) block.EWrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

多选题class One {   public One foo() { return this; }  }  class Two extends One {  public One foo() { return this; }  }  class Three extends Two {   // insert method here  }  Which two methods, inserted individually, correctly complete the Three class?()Apublic void foo() { }Bpublic int foo() { return 3; }Cpublic Two foo() { return this; }Dpublic One foo() { return this; }Epublic Object foo() { return this; }