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

题目内容 (请给出正确答案)
单选题
public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()
A

 0

B

 null

C

 Compilation fails.

D

 A NullPointerException is thrown at runtime.

E

 An ArrayIndexOutOfBoundsException is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()A  0B  nullC  Compilation fails.D  A NullPointerException is thrown at runtime.E  An ArrayIndexOutOfBoundsException is thrown at runtime.” 相关考题
考题 有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this-a = a;} // ②static int g(){return a;} // ③void h(intB . {Test::b = b;}; // ④private:int a;static int b;const int c;};int Test::b = 0;在标注号码的行中,能被正确编译的是A . ①B . ②C . ③D . ④

考题 有如下程序:includeusing namespace std;Class Test{public:Test(){n+=2;}~Test(){n- 有如下程序: #include<iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3

考题 有如下程序: #include(iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;) static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3

考题 执行下面程序段,屏幕上将输出( )。 public class Test { private int x=10,y=20; public Test (int x,int y) { System.out.println (x+this.x); System.out.println (y+y); } public static void main (String[] args) { Testt= new Test(30,50); } }A.无输出B.20 40C.40 100D.40 70

考题 已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?() A.t.fB.this.nC.Test.mD.Test.n

考题 给出下列代码,如何使成员变量m被方法fun( )直接访问?Class Test{private int m;public static void fun( ){} }A.将private int m改为protected int mB.将private int m改为public int mC.将private int m改为static int mD.将private int m改为int m

考题 给出下列代码,如何使成员变量m被方法fun( )直接访问? class Test{ private int m; public static void fun( ){ … } }A.将private int m改为protected int mB.将private int m改为public int mC.将private int m改为static iD.将private int m改为int m

考题 有如下程序: include using namespace std; class Test { public 有如下程序: #include<iostream> using namespace std; class Test { public: Test(){n+=2;} ~Test(){n-=3;} static int getNum(){return n;} private: static int n; }; int Tesl::n=1 int main() { Test*p=new Test; delete p; cout<<"n="<<Tes::tgetNum()<<endl; return 0; } 执行后的输出结果是A.n=0B.n=1C.n=2D.n=3

考题 已知有下列类的说明,则下列哪个语句是正确的?public class Test { private float f=1.0f; int m=12; static int n=1; public static void main(String arg[]) { Test t= new Test(); }}A.t.f;B.this. nC.Test.m;D.Test.f;

考题 下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出

考题 有如下程序: include using namespace std; class Test{ public: Tes 有如下程序: #include<iostream> using namespace std; class Test{ public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test; delete p; cout<<"n="<<Test::getNum()<<endl; return 0; } 执行后的输出结果是( )。A.n=0B.n=1C.n=2D.n=3

考题 如下程序的输出结果是includeusing namespace std;class Test{public:Test( ){n+=2;} 如下程序的输出结果是 #include<iostream> using namespace std; class Test{ public: Test( ){n+=2;} ~Test( ){n-=3;} static int getNum( ){return n;} private: static int n; }; int Test::n=1; int main( ){ Test*P=new Test: delete P; cout<<"n="<<Test::getNum( )<<endl; return 0; }A.n=0B.n=1C.n=2D. n=3

考题 已知有下面的类说明: public class Test4 { private float f=1.0f; int m=12; static int n=1; public static void main(String args[]) { Test4 e=new Test4(); } } 在main()方法中,下面哪个的使用是正确的? ( )A.e.fB.this.nC.Test4.mD.Test4.f

考题 有如下类定义: class Test { public: Test(){a=0;c=0} //① int f(int a)const{this->a=a;} //② static int g(){return a;} //③ void h(int b){Test::b;}; //④ private: int a; static int b; const int C; }; int Test::b=0; 在标注号码的行中,能被正确编译的是( )。A.①B.②C.③D.④

考题 有下列程序:includeusing namespace Std;class Test{public:Test(){n+=2;}~Test(){n- 有下列程序: #include<iostream> using namespace Std; class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum(){return n;} private: static int n; }; int Test∷n=1; int main()A.n=0B.n=lC.n=2D.n=3

考题 下面的例子中using System;class A{public static int X;static A(){X=B.Y+1;}}class B{public static int Y=A.X+1;static B(){}static void Main(){Console.WriteLine("X={0},Y={1}",A.X,B.Y);}}产生的输出结果是什么?

考题 阅读下面的程序public class Test {public static void main(String[] args) {for(int x = 0 ; x A.跳出循环,无输出B.0121C.01D.0123

考题 以下代码的输出结果?public class Test{int x=3;public static void main(String argv[]){int x= 012;System.out.println(x);}} A.12B.012C.10D.3

考题 package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.

考题 public class test (   private static int j = 0;     private static boolean methodB(int k) (  j += k;    return true;   )    public static void methodA(int i) {    boolean b:   b = i  10 | methodB (4);    b = i  10 || methodB (8);   )     public static void main (String args) } (    methodA (0);  system.out.printIn(j);   )    )   What is the result?()  A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.

考题 public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

考题 public class Test {  private static int[] x;  public static void main(String[] args) {  System.out.println(x[0]);  }  }   What is the result?()   A、 0B、 nullC、 Compilation fails.D、 A NullPointerException is thrown at runtime.E、 An ArrayIndexOutOfBoundsException is thrown at runtime.

考题 单选题public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()A  0B  1C  2D  Compilation fails.

考题 单选题package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?()A  x = 0B  x = 42C  Compilation fails because of an error in line 2 of class Test2.D  Compilation fails because of an error in line 3 of class Test1.E  Compilation fails because of an error in line 4 of class Test2.

考题 多选题现有:  public  class  TestDemo{     private int X-2;      static int y=3;  public  void method(){      final int i=100;      int j  =10;     class Cinner {  public void mymethod(){      //Here     }     }     }     } 在Here处可以访问的变量是哪些?()AXByCjDi

考题 单选题public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i  10 | methodB (4);  b = i  10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()A  The program prints “0”B  The program prints “4”C  The program prints “8”D  The program prints “12”E  The code does not complete.

考题 多选题public class TestDemo{   private int x = 2;   static int y = 3;   public void method(){   final int i=100;   int j = 10;   class Cinner{   public void mymethod(){  //Here  }  }  }  }   在Here处可以访问的变量是哪些?()AxByCiDj