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

题目内容 (请给出正确答案)

Public conters(2 to 14)As Integer声明正确的是()

  • A、定义一个公用变量conters,其值可以是2到14之间的一个整型数
  • B、定义一个公用数组conters,数组内可存放14个整数
  • C、定义一个公用数组conters,数组内可存放13个整数
  • D、定义一个公用数组conters,数组内可存放12个整数

参考答案

更多 “Public conters(2 to 14)As Integer声明正确的是()A、定义一个公用变量conters,其值可以是2到14之间的一个整型数B、定义一个公用数组conters,数组内可存放14个整数C、定义一个公用数组conters,数组内可存放13个整数D、定义一个公用数组conters,数组内可存放12个整数” 相关考题
考题 14类Test1定义如下: 1.publicclassTest1{ 2.publicfloataMethod(floata,floatb){} 3. 4.} 将以下哪种方法插入行3是不合法的。() A.public floata Method(floata,floatb,floatc){}B.public floata Method(floatc,floatd){}C.public inta Method(inta,intb){}D.private floata Method(inta,intb,intc){}

考题 ( 14 )请将如下程序补充完整,使得输出结果为: bbaa#includeiostreamusing namespace std;class A{public:___________{cout"aa";}};class B:public A{public:~B(){cout"bb";}};int main(){B *p=new B;delete p;return 0;}

考题 ( 32 )有如下程序:#includeiostreamUsing namespace std;class A{public:virtual void f () {cout+1;}void g () {cout2;}};class B:public A{public:virtual void f () {cout3;}void g () {ecut4;}};void show ( A a ) {a.f ( ) ; a.g ( ) ; }int main () {B b;show ( b ) ;return 0;}运行时的输出结果是A ) 12B ) 34C ) 14D ) 32

考题 下面程序的运行结果是#includeclass base{protected:int a;public:base(){ cout ”0”;}class basel:virtual base}public:base 1(){cout ”1”;}};class base2:virtual base{public:base2(){cout ”2”;(};class derived:public base1,public base2{public:derived(){cout ”3”;}};void main(){derived obj;cout }A.0123B.3120C.0312D.3012

考题 阅读下面程序 public class Test1 { public static void main(String[] args){ System.out.println(34+56-6); System.out.println(26*2-3); System.out.println(3*4/2); System.out.println(5/2); } } 程序运行结果是A.84 49 6 2B.90 25 6 2.5C.84 23 12 2D.68 49 14 2.5

考题 若有以下程序:include using namespace std;class A{protected: int a;public: A() { 若有以下程序: #include <iostream> using namespace std; class A { protected: int a; public: A() { a=10; } }; class A1 : public A { public: A1() { a=a+1; } }; class A2 : public A { public: A2 () { a=a+2; } }; class B : public A1,public A2 { public: B(){} void print() { cout<<a<<end1; } }; int main ( ) { B obj; obj.print(); return 0; } 程序运行后的输出结果是( )。A.产生语法错误B.11C.12D.10

考题 请完成下列Java程序:用awt实现一个图形用户界面,包含一个List构件和一个TextField构件,List中包含5个项目。要求选择不用的项目时,能在TextField构件中显示出相关的信息,包括事件的名称,选择的项目编号和项目的状态。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。程序运行结果如下:import java.awt.*;import java.awt.event.*;public class ex14_2 extends Frame. implements ItemListener {private TextField tf;private List 1;public static void main(String[] arg) {ex14_2 obj14_2 = new ex14_2();}public ex14_2() {setBackground(Color. GRAY);setTitle("ex14_2");l = new List(5);l.addItemListener(this);l.addItem("Item1");l.addItem("Item2");l.addItem("Item3");l.addItem("Item4");l.addItem("Item5");add("Center",l);tf = new TextField(50);add("South",tf);______________;show ( );}public void itemStateChanged(ItemEvent event)tf.setText( );}}

考题 class TestApp{   public static void main(String[] args){   System.out.println(multiply(2,3,4,5));  }   public int multiply(int… nums){   int result = 1;   for(int x :nums)   result *= x;  //result =result*x;   return result;  }  }   2、6、24、120   程序运行后的输出是哪项?()  A、 14B、 编译错误C、 120D、 24

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

考题 public class Threads 1 {  intx=0;  public class Runner implements Runnable {  public void run() {  int current = 0;  for(int=i=0;i4;i++){  current = x;  System.out.print(current + “, “);  x = current + 2;  }  }  }  public static void main(String[] args) {  new Threads1().go();  }  public void go() {  Runnable r1 = new Runner();  new Thread(r1).start();  new Thread(r1 ).start();  }  }  Which two are possible results?()A、 0, 2, 4, 4, 6, 8, 10, 6,B、 0, 2, 4, 6, 8, 10, 2, 4,C、 0, 2, 4, 6, 8, 10, 12, 14,D、 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14,E、 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14,

考题 11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()  A、 Line 13B、 Line 14C、 Line 18D、 Line 20

考题 class A {  public byte getNumber() {  return 1;  }  }  class B extends A {  public short getNumber() {  return 2;  }  public static void main(String args[]) {  B b = new B();  System.out.println(b.getNumber()); }  }   What is the result?()A、 1B、 2C、 An exception is thrown at runtime.D、 Compilation fails because of an error in line 8.E、 Compilation fails because of an error in line 14.

考题 class Beverage {   Beverage() { System.out.print("beverage "); }   }   class Beer extends Beverage {   public static void main(String [] args) {   Beer b = new Beer(14);   }   public int Beer(int x) {   this();   System.out.print("beer1 ");   }   public Beer() { System.out.print("beer2 "); }  }   结果是什么?()  A、beer1 beverageB、beer2 beverageC、beverage beer1D、编译失败

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

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

考题 单选题class Beverage {   Beverage() { System.out.print("beverage "); }   }   class Beer extends Beverage {   public static void main(String [] args) {   Beer b = new Beer(14);   }   public int Beer(int x) {   this();   System.out.print("beer1 ");   }   public Beer() { System.out.print("beer2 "); }  }   结果是什么?()A beer1 beverageB beer2 beverageC beverage beer1D 编译失败

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

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

考题 单选题现有  class Beverage {  Beverage ()  {  System.out.print ("beverage ");  }        }  class Beer extends Beverage {  public static void main{string [] args) {        Beer b = new Beer (14) ;       }  public int Beer(int x) {       this () ;  System.out.print ("beerl") ;      }  public Beer() { System.out.print("beer2 "); }     }  结果是什么?()A beerl beverageB beer2 beverageC beverage beer2 beerlD 编译失败

考题 单选题class A {   public byte getNumber () {   return 1;   }   }   class B extends A {   public short getNumber() {   return 2;   }    public static void main (String args) {   B b = new B ();    System.out.printIn(b.getNumber())  }   }   What is the result?()A  Compilation succeeds and 1 is printed.B  Compilation succeeds and 2 is printed.C  An error at line 8 causes compilation to fail.D  An error at line 14 causes compilation to fail.E  Compilation succeeds but an exception is thrown at line 14.

考题 单选题class A {   public int getNumber(int a) {   return a + 1;   }   }    class B extends A {   public int getNumber (int a) {   return a + 2   }    public static void main (String args) {   A a = new B();   System.out.printIn(a.getNumber(0));   }   }   What is the result? ()A  Compilation succeeds and 1 is printed.B  Compilation succeeds and 2 is printed.C  An error at line 8 causes compilation to fail.D  An error at line 13 causes compilation to fail.E  An error at line 14 causes compilation to fail.

考题 单选题Public conters(2 to 14)As Integer声明正确的是()A 定义一个公用变量conters,其值可以是2到14之间的一个整型数B 定义一个公用数组conters,数组内可存放14个整数C 定义一个公用数组conters,数组内可存放13个整数D 定义一个公用数组conters,数组内可存放12个整数

考题 多选题public class Threads 1 {  intx=0;  public class Runner implements Runnable {  public void run() {  int current = 0;  for(int=i=0;i4;i++){  current = x;  System.out.print(current + “, “);  x = current + 2;  }  }  }  public static void main(String[] args) {  new Threads1().go();  }  public void go() {  Runnable r1 = new Runner();  new Thread(r1).start();  new Thread(r1 ).start();  }  }  Which two are possible results?()A0, 2, 4, 4, 6, 8, 10, 6,B0, 2, 4, 6, 8, 10, 2, 4,C0, 2, 4, 6, 8, 10, 12, 14,D0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14,E0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14,

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

考题 单选题1. class A {  2. public int getNumber(int a) {  3.     return a + 1;  4. }  5. }  6.    7. class B extends A {  8. public int getNumber (int a) {  9. return a + 2  10. }  11.    12. public static void main (String args[])  {  13. A a = new B();  14. System.out.printIn(a.getNumber(0));  15.    } 16. }     What is the result?()A  Compilation succeeds and 1 is printed.B  Compilation succeeds and 2 is printed.C  An error at line 8 causes compilation to fail.D  An error at line 13 causes compilation to fail.E  An error at line 14 causes compilation to fail.

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