public class Alpha{  private static Character() ids;  public static void main( String[] args){  ids = new Character[args.length];  for (int i=0; iids[i] = new Character( args[i] );  System.out.print( ids[i] );  }  }  }   What is correct?()   A、 Compilation fails.B、 The code runs with no output.C、 An exception is thrown at runtime.D、 The code runs, outputing a concatenated list of the arguments passed to the program.

public class Alpha{  private static Character() ids;  public static void main( String[] args){  ids = new Character[args.length];  for (int i=0; iids[i] = new Character( args[i] );  System.out.print( ids[i] );  }  }  }   What is correct?()  

  • A、 Compilation fails.
  • B、 The code runs with no output.
  • C、 An exception is thrown at runtime.
  • D、 The code runs, outputing a concatenated list of the arguments passed to the program.

相关考题:

publicclassAlpha{privatestaticCharacter()ids;publicstaticvoidmain(String[]args){ids=newCharacter[args.length];for(inti=0;iids[i]=newCharacter(args[i]);System.out.print(ids[i]);}}}Whatiscorrect?() A.Compilationfails.B.Thecoderunswithnooutput.C.Anexceptionisthrownatruntime.D.Thecoderuns,outputingaconcatenatedlistoftheargumentspassedtotheprogram.

下列代码的执行结果是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.运行成功,但不输出

public class Something {public static void main(String[] args) {Other o = new Other();new Something().addOne(o);}public void addOne(final Other o) {o.i++;}}class Other {public int i;}和上面的很相似,都是关于final 的问题,这有错吗?

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

以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i A.0123 B.0122 C.123 D.234

以下程序的运行结果为?class ValHold{public int i = 10;}public class ObParm{public static void main(String argv[]){ObParm o = new ObParm();o.amethod();}public void amethod(){int i = 99;ValHold v = new ValHold();v.i=30;another(v,i);System.out.print( v.i );}public void another(ValHold v, int i){i=0;v.i = 20;ValHold vh = new ValHold();v = vh;System.out.print(v.i);System.out.print(i);}}A.10030B. 20030C. 209930D. 10020

( 30 )在程序的下划线处应填入的选项是public class Test _________{public static void main(String args[]){Test t = new Test();Thread tt = new Thread(t);tt.start();}public void run(){for(int i=0;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable

public class Test {  public static void add3 (Integer i) {  int val = i.intValue();  val += 3;  i = new Integer(val); }  public static void main(String args[]) {  Integer i = new Integer(0);  add3(i);  System.out.println(i.intValue());  }  }   What is the result? () A、 0B、 3C、 Compilation fails.D、 An exception is thrown at runtime.

class Super {  public int i = 0;  public Super(String text) {  i = 1; }  }  public class Sub extends Super {  public Sub(String text) {  i = 2;  }   public static void main(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

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

public class Test {  public static void leftshift(int i, int j) {  i=j;  }  public static void main(String args[])  {  int i = 4, j = 2;  leftshift(i, j);   System.out.printIn(i); }  }     What is the result?()  A、 2B、 4C、 8D、 16E、 The code will not compile.

public class TestOne implements Runnable {  public static void main (String[] args) throws Exception {  Thread t = new Thread(new TestOne());  t.start();  System.out.print(”Started”);  t.join();  System.out.print(”Complete”);  }  public void run() {  for (int i= 0; i 4; i++) {   System.out.print(i);  }  }  }  What can be a result?()A、 Compilation fails.B、 An exception is thrown at runtime.C、 The code executes and prints “StartedComplete”.D、 The code executes and prints “StartedComplete0123”.E、 The code executes and prints “Started0l23Complete”.

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.printIn(j);   ]  }   What is the result?()A、 Compilation will fail.B、 Compilation will succeed and the program will print “0”C、 Compilation will succeed and the program will print “1”D、 Compilation will succeed and the program will print “2”

public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()  A、 i = 3B、 Compilation fails.C、 A ClassCastException is thrown at line 6.D、 A ClassCastException is thrown at line 7.

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 (  Public static void stringReplace (String text)  (  Text = text.replace (‘j’ , ‘i’);  )  public static void bufferReplace (StringBuffer text)  (  text = text.append (“C”)  )   public static void main (String args[]}  (  String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”);  stringReplace (textString);  bufferReplace (textBuffer);  System.out.printLn (textString + textBuffer);  ) )  What is the output?()

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 static void add3 (Integer i){  int val = i.intValue ( );   val += 3;   i = new Integer (val);    }     public static void main (String args [ ] )  { Integer i = new Integer (0);    add3 (i);   system.out.printIn (i.intValue ( ) );   }    }   What is the result?()A、 Compilation will fail.B、 The program prints “0”.C、 The program prints “3”.D、 Compilation will succeed but an exception will be thrown at line 3.

class super (   public int I = 0;   public super (string text) (   I = 1   )   )     public class sub extends super (   public sub (string text) (   i= 2   )   public static void main (straing args) (  sub sub = new sub (“Hello”);   system.out. PrintIn(sub.i);  )   )   What is the result?()A、 Compilation will fail.B、 Compilation will succeed and the program will print “0”C、 Compilation will succeed and the program will print “1”D、 Compilation will succeed and the program will print “2”

单选题public class Alpha{  private static Character() ids;  public static void main( String[] args){  ids = new Character[args.length];  for (int i=0; iids[i] = new Character( args[i] );  System.out.print( ids[i] );  }  }  }   What is correct?()A Compilation fails.B The code runs with no output.C An exception is thrown at runtime.D The code runs, outputing a concatenated list of the arguments passed to the program.

单选题class super (  public int I = 0;  public super (string text) (  I = 1  )  )  public class sub extends super (  public sub (string text)   ( i= 2  )  public static void main (straing args[])   (  sub sub = new sub (“Hello”);  system.out. PrintIn(sub.i);  )    )   What is the result?()A Compilation will fail.B Compilation will succeed and the program will print “0”C Compilation will succeed and the program will print “1”D Compilation will succeed and the program will print “2”

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

单选题class Super {  public int i = 0;  public Super(String text) {  i = 1; }  }  public class Sub extends Super {  public Sub(String text) {  i = 2;  }   public static void main(String args[]) {  Sub sub = new Sub(“Hello”);  System.out.println(sub.i);  }  }  What is the result?()A 0B 1C 2D Compilation fails.

单选题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 {  public static void leftshift(int i, int j) {  i=j;  }  public static void main(String args[])  {  int i = 4, j = 2;  leftshift(i, j);   System.out.printIn(i); }  }     What is the result?()A 2B 4C 8D 16E The code will not compile.

单选题public class test {  public static void add3 (Integer i)  int val = i.intValue ( );  val += 3;  i = new Integer (val);  } public static void main (String args [ ] )  {  Integer  i = new Integer (0);  add3 (i);  system.out.printIn (i.intValue ( )  );  } What is the result?()A Compilation will fail.B The program prints “0”.C The program prints “3”.D Compilation will succeed but an exception will be thrown at line 3.

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