网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
多选题
10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()
A

i2 == startingI returns true.

B

i2 == startingI returns false.

C

i2.equals(startingI) returns true.

D

i2.equals(startingI) returns false.


参考答案

参考解析
解析: 暂无解析
更多 “多选题10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()Ai2 == startingI returns true.Bi2 == startingI returns false.Ci2.equals(startingI) returns true.Di2.equals(startingI) returns false.” 相关考题
考题 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.

考题 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 {

考题 有如下的类的模板定义: template class MyClass { private:T number; public:MyClass( 有如下的类的模板定义:template <class T>class MyClass{private:T number;public:MyClass(T k);…};其中构造函数MyClass()用k的值初始化数据成员n。因此在模板类体外,构造函数MyClass应定义为【 】。

考题 下列程序段中,正确的是______。 ①class MvClass { int var = 100; static int getVar() { return var; } } ②public class MyClass { final int date; void MyClass (int d) { date = d; } } ③public class MyMain { public static void main(String args[]) { System.out.println(Myclass1.date); } } class MyClass1 { int data = 10; } ④class IamAbstract { final int f; double d; abstrct void method(); }A.②④B.①③C.②D.以上都不对

考题 有以下程序:includeusing namespace std;class MyClass{public:MyClass(int n){numbe 有以下程序: #include<iostream> using namespace std; class MyClass { public: MyClass(int n){number=n;} //拷贝构造函数 MyClass(MyClassother) {number=other.number;} ~MyClass() {} private: int number; }; MyClass fun(MyClass p)A.5B.4C.3D.2

考题 如下的类定义,错误的语句是( )。class Myclass {public: int a=1; //A) Myclass( ); //B) Myclass(int i); //C) ~Myclass( ); //D)A.AB.BC.CD.D

考题 下列程序在构造函数和析构函数中申请和释放类的私有成员,请完成该类的实现。class Myclass {public:Myclass(int num);~ Myclass( );public:int *p;};Myclass: :Myclass( int hum) {【 】Myclass:: ~ Myelass( ) {【 】;}。

考题 有如下程序:includeusing namespace std;class MyClass{public:MyClass(){++count;}~ 有如下程序: #include<iostream> using namespace std; class MyClass{ public: MyClass(){++count;} ~MyClass(){--count;} static int getCount(){return count;} private: static int count; }; int MyClass::count=0; int main(){ MyClA.121B.232C.221D.122

考题 如下程序的输出结果是includeusing namespace std;class MyClass{public:MyClass(int 如下程序的输出结果是 #include<iostream> using namespace std; class MyClass{ public: MyClass(int i=0){cout<<1;} MyClass(const MyClass&x)}cout<<2;} }; int main( ){ MyClass objl(1),obj2(2),ohj3(objl); return 0; }A.112B.111C.121D.113

考题 定义一个类名为MyClass的类,并且该类可被所有类访问,那么该类的正确声明应为()A、private class MyClass extends ObjectB、class MyClass extends ObjectC、public class MyClassD、protected class MyClass extends Object

考题 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

考题 10. abstract public class Employee {  11. protected abstract double getSalesAmount();  12. public double getCommision() {  13. return getSalesAmount() * 0.15;  14. }  15. }  16. class Sales extends Employee {  17. // insert method here  18. }  Which two methods, inserted independently at line 17, correctly complete the Sales class?()A、 double getSalesAmount() { return 1230.45; }B、 public double getSalesAmount() { return 1230.45; }C、 private double getSalesAmount() { return 1230.45; }D、 protected double getSalesAmount() { return 1230.45; }

考题 Assume that country is set for each class.  Given:  10. public class Money {  11. private String country, name;  12. public getCountry() { return country; }  13.}  and:  24. class Yen extends Money {  25. public String getCountry() { return super.country; }  26. }  27.  28. class Euro extends Money {  29. public String getCountry(String timeZone) {  30. return super.getCountry();  31. }  32. }  Which two are correct?()A、 Yen returns correct values.B、 Euro returns correct values.C、 An exception is thrown at runtime.D、 Yen and Euro both return correct values.E、 Compilation fails because of an error at line 25.F、 Compilation fails because of an error at line 30.

考题 MyClass类的默认构造方法是哪一个?()A、new MyClass()B、MyClass(){}C、MyClass{}D、public class MyClass

考题 1. public class test (  2. public static void main(string args[]) {  3. int 1= 0;  4. while (i)  {  5. if (i==4) {  6. break;  7. }  8. ++i;  9. }  10.    11. }  12. )   What is the value of i at line 10?()A、 0B、 3C、 4D、 5E、 The code will not compile.

考题 10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()A、 i2 == startingI returns true.B、 i2 == startingI returns false.C、 i2.equals(startingI) returns true.D、 i2.equals(startingI) returns false.

考题 10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?() A、 Point p = Line.getPoint();B、 Line.Point p = Line.getPoint();C、 Point p = (new Line()).getPoint();D、 Line.Point p = (new Line()).getPoint();

考题 单选题1. class A {  2. public String toString ()  {  3. return “4”;  4. }  5. }  6. class B extends A {  7. public String toString ()   {  8. return super.toString()  + “3”;  9. }  10. }  11. public class Test {  12.   public static void main(String[]args)  {  13.      System.out.printIn(new B());  14.      }  15. }    What is the result?()A  Compilation succeeds and 4 is printed.B  Compilation succeeds and 43 is printed.C  An error on line 9 causes compilation to fail.D  An error on line 14 causes compilation to fail.E  Compilation succeeds but an exception is thrown at line 9.

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

考题 单选题1. public class SimpleCalc {  2. public int value;  3. public void calculate() { value += 7; }  4. } And:  1. public class MultiCalc extends SimpleCalc {  2. public void calculate() { value -= 3; }  3. public void calculate(int multiplier) {  4. calculate();  5. super.calculate();  6. value *=multiplier;  7. }  8. public static void main(String[] args) {  9. MultiCalc calculator = new MultiCalc();  10. calculator.calculate(2);  11. System.out.println(”Value is: “+ calculator.value);  12. }  13. }  What is the result?()A  Value is: 8B  Compilation fails.C  Value is: 12D  Value is: -12E  The code runs with no output.F  An exception is thrown at runtime.

考题 单选题10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()A  Point p = Line.getPoint();B  Line.Point p = Line.getPoint();C  Point p = (new Line()).getPoint();D  Line.Point p = (new Line()).getPoint();

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

考题 单选题1. public class test (  2. public static void main(string args[]) {  3. int 1= 0;  4. while (i)  {  5. if (i==4) {  6. break;  7. }  8. ++i;  9. }  10.    11. }  12. )   What is the value of i at line 10?()A  0B  3C  4D  5E  The code will not compile.

考题 多选题1. class Super {  2. private int a;  3. protected Super(int a) { this.a = a; }  4. }  .....  11. class Sub extends Super {  12. public Sub(int a) { super(a); }  13. public Sub() { this.a= 5; }  14. }  Which two, independently, will allow Sub to compile?()AChange line 2 to: public int a;BChange line 2 to: protected int a;CChange line 13 to: public Sub() { this(5); }DChange line 13 to: public Sub() { super(5); }EChange line 13 to: public Sub() { super(a); }

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

考题 单选题10. class Nav{  11. public enum Direction { NORTH, SOUTH, EAST, WEST }  12. }  13. public class Sprite{  14. // insert code here  15. }  Which code, inserted at line 14, allows the Sprite class to compile?()A  Direction d = NORTH;B  Nav.Direction d = NORTH;C  Direction d = Direction.NORTH;D  Nav.Direction d = Nav.Direction.NORTH;

考题 多选题10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()Ai2 == startingI returns true.Bi2 == startingI returns false.Ci2.equals(startingI) returns true.Di2.equals(startingI) returns false.

考题 多选题10. abstract public class Employee {  11. protected abstract double getSalesAmount();  12. public double getCommision() {  13. return getSalesAmount() * 0.15;  14. }  15. }  16. class Sales extends Employee {  17. // insert method here  18. }  Which two methods, inserted independently at line 17, correctly complete the Sales class?()Adouble getSalesAmount() { return 1230.45; }Bpublic double getSalesAmount() { return 1230.45; }Cprivate double getSalesAmount() { return 1230.45; }Dprotected double getSalesAmount() { return 1230.45; }