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

题目内容 (请给出正确答案)
单选题
package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()
A

 Compilation succeeds.

B

 Compilation fails because of an error at line 5.

C

 Compilation fails because of an error at line 6.

D

 Compilation fails because of an error at line 14.

E

 Compilation fails because of an error at line 17.


参考答案

参考解析
解析: 暂无解析
更多 “单选题package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()A  Compilation succeeds.B  Compilation fails because of an error at line 5.C  Compilation fails because of an error at line 6.D  Compilation fails because of an error at line 14.E  Compilation fails because of an error at line 17.” 相关考题
考题 有如下类定义:class Foo{public:Foo(int v):value(v){} // ①~Foo(){} // ②private:Foo(){} // ③int value = 0; // ④};其中存在语法错误的行是A . ①B . ②C . ③D . ④

考题 下列Java源程序结构中前三种语句的次序,正确的是A.import, package, public classB.import必为首,其他不限C.public class, import, packageD.package, import, public class

考题 下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }

考题 下列( )选项的java源文件代码片段是不正确的。A.package testpackage; publicClass Test{}B.import java.io.*; package testpackage: publicClass Test{}C.import java.io.*; Class Person{} publicClass Test{}D.import java.io.*; import java.awt.*; publicClass Test{}

考题 有如下类定义: 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.④

考题 下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }

考题 现有如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.*;

考题 一个程序中,package、import、和class的排放次序是()A、package、import、classB、import、package、classC、三者任意D、class在最后,import、package排放次序任意

考题 现有包结构:  com |-- x | |-- Alpha.class | | | |-- y | |-- Beta.class | |-- Gamma.class  和类:  //insert code here  import com.*;  import com.x.y.*;  class Test { Alpha a; Beta b; Gamma c; }  哪两行分别插入后可允许代码编译?() A、package com.;B、import com.x;C、package com.x;D、import com.x.Alpha;

考题 package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?() A、 Compilation fails.B、 An instance of the Inner class can be constructed with “new Outer.Inner()”.C、 An instance of the Inner class cannot be constructed outside of package foo.D、 An instance of the Inner class can be constructed only from within the Outer class.E、 From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.

考题 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 */ }

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

考题 在单一文件中import、class和package的正确出现顺序是()A、package,import,classB、class,import,packageC、import,package,classD、package,class,import

考题 在Java语言中,在包Package1中包含包Package2,类Class_A直接隶属于包Package1,类Class_B直接隶属于包Package2,在类Class_C要应用Class_A的方法A和Class_B的方法B,你需要()语句。A、import Package1.*;B、import Package1.Package2.*;C、import Package2.*;D、import Package2.Package1.*;

考题 package foo; public class Outer (  public static class Inner (  )  )   Which statement is true? () A、 An instance of the Inner class can be constructed with “new Outer.Inner ()”B、 An instance of the inner class cannot be constructed outside of package foo.C、 An instance of the inner class can only be constructed from within the outer class.D、 From within the package bar, an instance of the inner class can be constructed with “new inner()”

考题 package foo;  import java.util.Vector; private class MyVector extends Vector {  int i = 1;  public MyVector() {  i = 2; } }  public class MyNewVector extends MyVector {  public MyNewVector() {  i = 4;  }  public static void main(String args[]) {  MyVector v = new MyNewVector();  }  }  What is the result?()A、 Compilation succeeds.B、 Compilation fails because of an error at line 5.C、 Compilation fails because of an error at line 6.D、 Compilation fails because of an error at line 14.E、 Compilation fails because of an error at line 17.

考题 下列有关类声明的代码片段,哪一项是正确的?() A、 import java.sql.*; package school; class Student{ }B、 package school; import java.sql.*; class Student{ }C、 package school; class Student{ } import java.sql.*;D、 package school; import java.sql.*;private String name; class Student{ }

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

考题 单选题在单一文件中import、class和package的正确出现顺序是()A package,import,classB class,import,packageC import,package,classD package,class,import

考题 单选题1. package foo;  2.    3. import java.util.Vector;  4.    5. private class MyVector extends Vector {  6. int i = 1;  7. public MyVector()  {  8. i = 2;  9.    }  10. }  11.    12. public class MyNewVector extends MyVector {  13. public MyNewVector ()  {  14. i = 4;  15. }  16. public static void main (String args [])  {  17. MyVector v = new MyNewVector();  18.   }  19. }     The file MyNewVector.java is shown in the exhibit.  What is the result?()A  Compilation will succeed.B  Compilation will fail at line 5.C  Compilation will fail at line 6.D  Compilation will fail at line 14.E  Compilation will fail at line 17.

考题 单选题package foo;   import java.util.Vector;   private class MyVector extends Vector {  int i = 1;   public MyVector() {   i = 2;  }   }   public class MyNewVector extends MyVector {   public MyNewVector () {   i = 4;   }   public static void main (String args ) {    MyVector v = new MyNewVector();   }   }   The file MyNewVector.java is shown in the exhibit.  What is the result?()A  Compilation will succeed.B  Compilation will fail at line 5.C  Compilation will fail at line 6.D  Compilation will fail at line 14.E  Compilation will fail at line 17.

考题 单选题下列有关类声明的代码片段,哪一项是正确的?()A  import java.sql.*; package school; class Student{ }B  package school; import java.sql.*; class Student{ }C  package school; class Student{ } import java.sql.*;D  package school; import java.sql.*;private String name; class Student{ }

考题 单选题一个程序中,package、import、和class的排放次序是()A package、import、classB import、package、classC 三者任意D class在最后,import、package排放次序任意

考题 单选题下列Java源程序结构中前三种语句的次序,正确的是(  )。A import,package,public classB import必为首,其他不限C public class,package,importD package,import,public class

考题 单选题package foo; public class Outer (  public static class Inner (  )  )   Which statement is true? ()A  An instance of the Inner class can be constructed with “new Outer.Inner ()”B  An instance of the inner class cannot be constructed outside of package foo.C  An instance of the inner class can only be constructed from within the outer class.D  From within the package bar, an instance of the inner class can be constructed with “new inner()”

考题 单选题1. package foo; 2.  3. import java.util.Vector; 4.  5. protected class MyVector Vector { 6. init i = 1; 7. public MyVector() { 8. i = 2; 9. } 10. } 11.  12. public class MyNewVector extends MyVector { 13. public MyNewVector() { 14. i = 4; 15. } 16. public static void main(String args[]) { 17. MyVector v = new MyNewVector(); 18. } 19. } What is the result?()A  Compilation succeeds.B  Compilation fails because of an error at line 5.C  Compilation fails because of an error at line 6.D  Compilation fails because of an error at line 14.E  Compilation fails because of an error at line 17.

考题 单选题package foo;  public class Outer {  public static class Inner {  }  }   Which statement is true?()A  Compilation fails.B  An instance of the Inner class can be constructed with “new Outer.Inner()”.C  An instance of the Inner class cannot be constructed outside of package foo.D  An instance of the Inner class can be constructed only from within the Outer class.E  From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.