单选题Given: Which code, inserted at line 15, creates an instance of the Point class defined in Line?()A Point p = new Point();B Line.Point p = new Line.Point();C The Point class cannot be instatiated at line 15.D Line l = new Line() ; l.Point p = new l.Point();

单选题
Given: Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
A

Point p = new Point();

B

Line.Point p = new Line.Point();

C

The Point class cannot be instatiated at line 15.

D

Line l = new Line() ; l.Point p = new l.Point();


参考解析

解析: 暂无解析

相关考题:

classLine{11.publicstaticclassPoint{}12.}13.14.classTriangle{15.//insertcodehere16.}Whichcode,insertedatline15,createsaninstanceofthePointclassdefinedinLine?() A.Pointp=newPoint();B.Line.Pointp=newLine.Point();C.ThePointclasscannotbeinstatiatedatline15.D.Line1=newLine();1.Pointp=new1.Point();

阅读下列C++程序和程序说明,将应填入(n)处的字句写在对应栏内。【说明】Point是平面坐标系上的点类,Line是从Point派生出来的直线类。include <iostream.h>class Point{public:Point (int x, int y) ;Point (Point p) ;~Point();void set (double x, double y) ;void print();private:double X,Y;};Point::Point (int x, int y) //Point 构造函数{X=x; Y=y; }Point::Point ( (1) ) //Point 拷贝构造函数{X=p.X; Y=p.Y;}void Point::set (double x, double y){X=x; Y=y; }void Point::print(){cout<<' ('<<X<<","<<Y<<") "<<endl; }Point::~Point(){cout<<"Point 的析构函数被调用! "<<endl;class Line: public Point{public:Line (int x, int y, int k) ;Line (Line s) ;~Line();void set (double x, double y, double k)void print();private:double K;};(2)//Line 构造函数实现{ K=k;}(3)//Line 拷贝构造函数实现{K=s.K;}void Line::set (double x, double y, double k){ (4);K=k;}void Line::print(){cout<<" 直线经过点";(5);cout<<"斜率为: k="<<K<<endl;}Line: :~Line(){cout<<"Line 析构函数被调用! "<<endl;}void main(){Line 11 (1,1,2) ;11 .print();Linel2 (11) ;12.set (3,2,1) ;12.print();}

Given:Which code, inserted at line 15, creates an instance of the Point class defined in Line?() A.Point p = new Point();B.Line.Point p = new Line.Point();C.The Point class cannot be instatiated at line 15.D.Line l = new Line() ; l.Point p = new l.Point();

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; }

Given: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. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()  A、 new Inner(); // At line 3B、 new Inner(); // At line 8C、 new o.Inner(); // At line 8D、 new Outer.Inner(); // At line 8

class Super {  public int getLenght( ) { return 4; }  }  public class Sub extends Super {  public long getLenght( ) { return 5; }  public static void main(String[] args) {  Super sooper = new Super( );  Sub sub = new Sub( );  System.out.println(  sooper.getLenght( ) + “,” + sub.getLenght( ) );  }  } What is the output?()A、 Just after line 13.B、 Just after line 14.C、 Just after line 15.D、 Just after line 16 (that is, as the method returns).

10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?() A、 Point p = new Point();B、 Line.Point p = new Line.Point();C、 The Point class cannot be instatiated at line 15.D、 Line 1 = new Line() ; 1.Point p = new 1.Point();

Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() A、 The declaration on line 2 does not allocate memory space for the variable myVect.B、 The declaration on line 2 allocates memory space for a reference to a Vector object.C、 The statement on line 2 creates an object of class Vector.D、 The statement on line 3 creates an object of class Vector.E、 The statement on line 3 allocates memory space for an object of class Vector.

Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()   A、 line 3B、 line 6C、 line 7D、 line 8E、 line 10

// Point X  public class foo {  public static void main(String[] args) throws Exception {  jave.io.PrintWriter out = new jave.io.PrintWriter(  new jave.io.OutputStreamWriter(System.out), true); out.println(“Hello”); }  }   Which statement at Point X on line 1 is required to allow this code to compile?()  A、 No statement is required.B、 import jave.io.*;C、 include java.io.*;D、 import jave.io.PrintWriter;E、 include java.io.PrintWriter;

1. class Bar { }  1. class Test {  2. Bar doBar() {  3. Bar b = new Bar();  4. return b;  5. }  6. public static void main (String args[]) {  7. Test t = new Test();  8. Bar newBar = t.doBar();  9. System.out.println(“newBar”);  10. newBar = new Bar();  11. System.out.println(“finishing”);  12. }  13. } At what point is the Bar object, created on line 3, eligible for garbage collection?()  A、 After line 8.B、 After line 10.C、 After line 4, when doBar() completes.D、 After line 11, when main() completes.

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();

Given:   11. public void genNumbers() {   12. ArrayList numbers = new ArrayList();   13. for (int i=0; i10; i++) { 14. int value = i * ((int) Math.random());   15. Integer intObj = new Integer(value);   16. numbers.add(intObj);   17. }   18. System.out.println(numbers);   19. }   Which line of code marks the earliest point that an object referenced by intObj becomes a  candidate for garbage collection?()A、 Line 19B、 The object is NOT a candidate for garbage collection.C、 Line 17D、 Line 16E、 Line 18

单选题1. public class Outer{  2. public void someOuterMethod() {  3. // Line 3  4. }  5. public class Inner{}  6. public static void main( String[]argv ) {  7. Outer o = new Outer();  8. // Line 8  9. }  10. }  Which instantiates an instance of Inner?()A new Inner(); // At line 3B new Inner(); // At line 8C new o.Inner(); // At line 8D new Outer.Inner(); // At line 8

单选题Given: Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()A Line 16B Line 17C Line 18D Line 19

单选题Click the Exhibit button. Given this code from Class B: 25.A a1 = new A(); 26.A a2 = new A(); 27.A a3 = new A(); 28.System.out.println(A.getInstanceCount()); What is the result?()A Compilation of class A fails.B Line 28 prints the value 3 to System.out.C Line 28 prints the value 1 to System.out.D A runtime error occurs when line 25 executes.E Compilation fails because of an error on line 28.

单选题Given the following code:     1) class Parent {     2) private String name;     3) public Parent(){}     4) }  5) public class Child extends Parent {     6) private String department;  7) public Child() {}  8) public String getValue(){ return name; }     9) public static void main(String arg[]) {     10) Parent p = new Parent();     11) }  12) }  Which line will cause error?()A line 3B line 6C line 7D line 8E line 10

问答题In the xy plane, is the point (4, -2) on the line l?  (1) Point (1, 1) is on line l.  (2) The equation x=2-y describes line l.

单选题Given:  Which code, inserted at line 15, creates an instance of the Point class defined in Line?()A  Line l = new Line() ; l.Point p = new l.Point();B  Line.Point p = new Line.Point();C  The Point class cannot be instatiated at line 15.D  Point p = new Point();

单选题Click the Exhibit button.   Given this code from Class B:   25. A a1 = new A();   26. A a2 = new A();   27. A a3 = new A();   28. System.out.println(A.getInstanceCount());   What is the result?()A  Compilation of class A fails.B  Line 28 prints the value 3 to System.out.C  Line 28 prints the value 1 to System.out.D  Compilation fails because of an error on line 28.E  A runtime error occurs when line 25 executes.

多选题Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()AThe declaration on line 2 does not allocate memory space for the variable myVect.BThe declaration on line 2 allocates memory space for a reference to a Vector object.CThe statement on line 2 creates an object of class Vector.DThe statement on line 3 creates an object of class Vector.EThe statement on line 3 allocates memory space for an object of class Vector.

单选题Given:   11. public void genNumbers() {   12. ArrayList numbers = new ArrayList();   13. for (int i=0; i10; i++) { 14. int value = i * ((int) Math.random());   15. Integer intObj = new Integer(value);   16. numbers.add(intObj);   17. }   18. System.out.println(numbers);   19. }   Which line of code marks the earliest point that an object referenced by intObj becomes a  candidate for garbage collection?()A Line 19B The object is NOT a candidate for garbage collection.C Line 17D Line 16E Line 18

单选题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 Bar { }  1. class Test {  2. Bar doBar() {  3. Bar b = new Bar();  4. return b;  5. }  6. public static void main (String args[]) {  7. Test t = new Test();  8. Bar newBar = t.doBar();  9. System.out.println(“newBar”);  10. newBar = new Bar();  11. System.out.println(“finishing”);  12. }  13. } At what point is the Bar object, created on line 3, eligible for garbage collection?()A After line 8.B After line 10.C After line 4, when doBar() completes.D After line 11, when main() completes.

单选题10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?()A Point p = new Point();B Line.Point p = new Line.Point();C The Point class cannot be instatiated at line 15.D Line 1 = new Line() ; 1.Point p = new 1.Point();

单选题class Super {  public int getLenght( ) { return 4; }  }  public class Sub extends Super {  public long getLenght( ) { return 5; }  public static void main(String[] args) {  Super sooper = new Super( );  Sub sub = new Sub( );  System.out.println(  sooper.getLenght( ) + “,” + sub.getLenght( ) );  }  } What is the output?()A Just after line 13.B Just after line 14.C Just after line 15.D Just after line 16 (that is, as the method returns).

单选题11. public void genNumbers() {  12. ArrayList numbers = new ArrayList();  13. for (int i=0; i10; i++) {  14. int value = i * ((int) Math.random());  15. Integer intObj = new Integer(value);  16. numbers.add(intObj);  17. }  18. System.out.println(numbers);  19. }  Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()A Line 16B Line 17C Line 18D Line 19E The object is NOT a candidate for garbage collection.