现有: 1. class Wrench f 2.public static void main(String [] args) { 3.Wrench w=new Wrench( ); Wrench w2=new Wrench( ); 4. w2=go (w, w2); 5.System.out.print (w2==w); 6. } 7.static Wrench go (Wrench wrl, Wrench wr2) { 8.Wrench wr3=wrl; wrl=wr2; wr2=wr3; 9. return wr3; 10. } 11. } 结果是什么?()A、falseB、trueC、编译失败D、运行的时候有异常抛出

现有: 1. class Wrench f 2.public static void main(String [] args) { 3.Wrench w=new Wrench( ); Wrench w2=new Wrench( ); 4. w2=go (w, w2); 5.System.out.print (w2==w); 6. } 7.static Wrench go (Wrench wrl, Wrench wr2) { 8.Wrench wr3=wrl; wrl=wr2; wr2=wr3; 9. return wr3; 10. } 11. } 结果是什么?()

  • A、false
  • B、true
  • C、编译失败
  • D、运行的时候有异常抛出

相关考题:

有如下程序: include using namespaee std; class ONE{ public: virtual void f 有如下程序:include <iostream>using namespaee std;class ONE{public:virtual void f( ){cout<<"1";}};class TWO:public ONE{public:TWO( )1 cout<<"2";}{;class THREE:public TWO{public:virtual void f( )}TWO::f( );cout<<"3";}};int main( ){ONE aa,*P;TWO bb;THREE cc;P=cc;p->f( );return 0;}程序的输出结果是______。

有如下程序: include using namespace std; class A { public: virtual void f(){cout 有如下程序:include<iostream>using namespace std;class A{public:virtual void f(){cout<<"1";}};class B:public A{public:B (){cout<<"2";}};class C:public B{public:virtual void f(){B::f();cout<<"3";}};int main(){A aa,*p;B bb;C cc;p=cc;p->f();return 0;}执行上面程序的输出是______。

现有如F包结构:com|一一X||一一Alpha.class||||一一yI|一一Beta.class||l--Gamma.class和类:classTest{Alphaa;Betab;Gammac;}哪三个必须加入到类Test中,以使其通过编译?() A.packagey;B.packagecom;C.importcom.x.y.*;D.importcom.x.*;

现有:classWrench2{intsize;publicstaticvoidmain(String[]args){Wrench2w=newWrench2();w.size=II;Wrench2w2=go(w,w.size);System.out.print(w2.size);}staticWrench2go(Wrench2wr.ints){S=12;returnwr;}}结果为() A.11B.12C.编译失败D.运行时异常被抛出

现有两个类A,B,以下描述中表示B继承自A的是 ( )A.class A extends BB.class B implements AC.class A implements BD.class B extends A

下面的代码中有什么错误吗?_______using System;class A{public virtual void F(){Console.WriteLine("A.F");}}abstract class B:A{public abstract override void F();

在下面程序中,编译出现错误的语句是 ______。 class B { public: B( ){f(); } virtual void f()=0; };A.class BB.public:C.B() {f();}D.virtual void f()=0;

现有如F包结构:      com     |一一X      |    |一一Alpha.class     |    |      |    |一一y      I         |一一Beta.class     |      |l-- Gamma.class    和类:      class Test  {  Alpha a;  Beta b; Gamma c;  }  哪三个必须加入到类Test中,以使其通过编译?() A、 package y;B、 package com;C、 import com.x.y.*;D、 import com.x.*;

Given classes defined in two different files:  1. package util;  2. public class BitUtils {  3. private static void process(byte[] b) { }  4. }  1. package app;  2. public class SomeApp {  3. public static void main(String[] args) {  4. byte[] bytes = new byte[256];  5. // insert code here  6. }  7. }  What is required at line 5 in class SomeApp to use the process method of BitUtils?() A、 process(bytes);B、 BitUtils.process(bytes);C、 app.BitUtils.process(bytes);D、 util.BitUtils.process(bytes);E、 import util.BitUtils. *; process(bytes);F、 SomeApp cannot use the process method in BitUtils.

现有:  class Wrench f  public static void main(String  []  args)  {  Wrench w=new Wrench();    Wrench w2=new Wrench();     w2=go (w, w2);      System.out.print (w2==w);      }  static Wrench go (Wrench wrl,  Wrench wr2)  {     Wrench wr3=wrl; wrl=wr2; wr2=wr3;     return wr3;      }       结果是什么?()     A、 falseB、 trueC、编译失败D、运行的时候有异常抛出

Given classes defined in two different files: 1.package util; 2.public class BitUtils{ 3.private static void process(byte[]b){} 4.} 1.package app; 2.public class SomeApp{ 3.public static void main(String[]args){ 4.byte[]bytes=newbyte[256]; 5.//insert code here 6.} 7.} What is required at line 5 in class SomeApp to use the process method of BitUtils?()A、process(bytes);B、BitUtils.process(bytes);C、app.BitUtils.process(bytes);D、util.BitUtils.process(bytes);E、importutil.BitUtils.*;process(bytes);F、SomeApp cannot use the process method in BitUtils.

现有:      1  Interface F{}  2  class A implements F{}      3  class B extends A{}      4  class C extends B{  5    public static void main(String[]  args){      6    B b=new B();  7    //inSert C0de here      8    }      9    } 下列哪行代码插入到第7行,将抛出java.lang.ClassCaseException异常()A、   A a=b;B、  F f=  (C)b;C、  F f=  (A)b;D、  B bb=  (B)(A)b;

1.public class test (  2.public static void main (String args[])    {  3.int  i = 0xFFFFFFF1;  4.int  j = ~i;  5.    6.}  7.)    What is the decimal value of j at line 5?()  A、 0B、 1C、 14D、 –15E、 An error at line 3 causes compilation to fail.F、 An error at line 4 causes compilation to fail.

1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  A、  Public float getNum()   {return 4.0f; }B、  Public void getNum ()  { }C、  Public void getNum (double d)   { }D、  Public double getNum (float d) {retrun 4.0f; }

现有:  class  Wrench2  {      int size;  public static void main(String  []  args)  {      Wrench2 w=new Wrench2();      w.size=II;  Wrench2 w2=go(w, w.size);     System. out .print (w2. size);      }  static Wrench2 go(Wrench2 wr. int s)  {      S=12;  return wr;     }     } 结果为()    A、 11B、 12C、编译失败D、运行时异常被抛出

1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()  A、 Compilation will fail.B、 Compilation will succeed and the program will print “3”C、 Compilation will succeed but the program will throw a ClassCastException at line 6.D、 Compilation will succeed but the program will throw a ClassCastException at line 7.

单选题1.public class test (  2.public static void main (String args[])    {  3.int  i = 0xFFFFFFF1;  4.int  j = ~i;  5.    6.}  7.)    What is the decimal value of j at line 5?()A 0B 1C 14D –15E An error at line 3 causes compilation to fail.F An error at line 4 causes compilation to fail.

单选题Given classes defined in two different files: 1.package util; 2.public class BitUtils{ 3.private static void process(byte[]b){} 4.} 1.package app; 2.public class SomeApp{ 3.public static void main(String[]args){ 4.byte[]bytes=newbyte[256]; 5.//insert code here 6.} 7.} What is required at line 5 in class SomeApp to use the process method of BitUtils?()Aprocess(bytes);BBitUtils.process(bytes);Capp.BitUtils.process(bytes);Dutil.BitUtils.process(bytes);Eimportutil.BitUtils.*;process(bytes);FSomeApp cannot use the process method in BitUtils.

单选题1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()A  Public float getNum()   {return 4.0f; }B  Public void getNum ()  { }C  Public void getNum (double d)   { }D  Public double getNum (float d) {retrun 4.0f; }

单选题1. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()A public void getNum(){}B public void getNum(double d){}C public float getNum() { return 4.0f; }D public double getNum(float d) { return 4.0d; }

单选题现有:  1. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6.  7. public class HouseCat extends Feline {  8. public void eat() { }  9. }   和五个声明:  abstract class Feline implements Animal { }  abstract class Feline implements Animal { void eat(); }  abstract class Feline implements Animal { public void eat(); }  abstract class Feline implements Animal { public void eat() { } }  abstract class Feline implements Animal { abstract public void eat(); }  分别插入到第5行,有几个可以通过编译?()A0B1C2D3

单选题现有:  class  Wrench2  {      int size;  public static void main(String  []  args)  {      Wrench2 w=new Wrench2();      w.size=II;  Wrench2 w2=go(w, w.size);     System. out .print (w2. size);      }  static Wrench2 go(Wrench2 wr. int s)  {      S=12;  return wr;     }     } 结果为()A 11B 12C编译失败D运行时异常被抛出

单选题现有:  class Wrench f  public static void main(String  []  args)  {  Wrench w=new Wrench();    Wrench w2=new Wrench();     w2=go (w, w2);      System.out.print (w2==w);      }  static Wrench go (Wrench wrl,  Wrench wr2)  {     Wrench wr3=wrl; wrl=wr2; wr2=wr3;     return wr3;      }       结果是什么?()A falseB trueC编译失败D运行的时候有异常抛出

单选题1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?()A Compilation succeeds.B An exception is thrown.C Compilation fails because of an error at line 2.D Compilation fails because of an error at line 6.

单选题class Wrench2 {  int size;  public static void main(String [] args) {  Wrench2 w = new Wrench2();  w.size = 9;  Wrench2 w2 = go(w, w.size);  System.out.print(w2.size);  }  static Wrench2 go(Wrench2 wr, int s) {  s = 7;  return wr;  }  }  结果为:()A7B9C编译失败D输出结果不可预料

单选题Given a class Repetition:  1. package utils;  2.  3. public class Repetition {  4. public static String twice(String s) { return s + s; }  5. }  and given another class Demo:  1. // insert code here 2.  3. public class Demo {  4. public static void main(String[] args) {  5. System.out.println(twice(”pizza”));  6. }  7. }  Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()A import utils.*;B static import utils.*;C import utils.Repetition.*;D static import utils.Repetition. *;E import utils.Repetition.twice();F import static utils.Repetition.twice;G static import utils.Repetition.twice;

单选题class Wrench {  public static void main(String [] args) {  Wrench w = new Wrench(); Wrench w2 = new Wrench();  w2 = go(w,w2);  System.out.print(w2 == w);  }  static Wrench go(Wrench wr1, Wrench wr2) {  Wrench wr3 = wr1; wr1 = wr2; wr2 = wr3;  return wr3; }  }  结果是什么?()AtrueBfalseC编译失败D输出不可预期