单选题What is the result?()A  The program runs and prints nothing.B  The program runs and prints “Equal”.C  An error at line 5 cause compilation to fail.D  The program runs but aborts with an exception.

题目
单选题
What is the result?()
A

 The program runs and prints nothing.

B

 The program runs and prints “Equal”.

C

 An error at line 5 cause compilation to fail.

D

 The program runs but aborts with an exception.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

1. public class X {  2. public static void main (String[]args)   {  3. int [] a = new int [1]  4. modify(a);  5. System.out.printIn(a[0]);  6. }  7.    8. public static void modify (int[] a)  {  9.   a[0] ++;  10.    } 11. }       What is the result?()

  • A、 The program runs and prints “0”
  • B、 The program runs and prints “1”
  • C、 The program runs but aborts with an exception.
  • D、 An error “possible undefined variable” at line 4 causes compilation to fail.
  • E、 An error “possible undefined variable” at line 9 causes compilation to fail.

正确答案:B

第2题:

public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()

  • A、 The program runs and prints nothing.
  • B、 The program runs and prints “Finally”
  • C、 The code compiles, but an exception is thrown at runtime.
  • D、 The code will not compile because the catch block is missing.

正确答案:B

第3题:

public class Test {   public static void main (String args) {  string foo = “blue”;  string bar = foo;   foo = “green”;   System.out.printIn(bar);   }   }   What is the result?()  

  • A、 An exception is thrown.
  • B、 The code will not compile.
  • C、 The program prints “null”
  • D、 The program prints “blue”
  • E、 The program prints “green”

正确答案:D

第4题:

 public class X {   public static void main (String[]args)   {   string s = new string (“Hello”);   modify(s);   System.out.printIn(s);   }   public static void modify (String s)  {   s += “world!”;      }   }      What is the result?()    

  • A、 The program runs and prints “Hello”
  • B、 An error causes compilation to fail.
  • C、 The program runs and prints “Hello world!”
  • D、 The program runs but aborts with an exception.

正确答案:A

第5题:

public class ForBar {   public static void main(String args) {   int i = 0, j = 5;   tp: for (;;) {   i ++;   for(;;)   if(i > --j) break tp;   }   system.out.printIn(“i = ” + i + “, j = “+ j);   }   }   What is the result? () 

  • A、 The program runs and prints “i=1, j=0”
  • B、 The program runs and prints “i=1, j=4”
  • C、 The program runs and prints “i=3, j=4”
  • D、 The program runs and prints “i=3, j=0”
  • E、 An error at line 4 causes compilation to fail.
  • F、 An error at line 7 causes compilation to fail.

正确答案:A

第6题:

1. public class ForBar  {  2. public static void main(String []args)   {  3.   int i = 0, j = 5;  4. tp: for (;;)  {  5. i ++;  6. for(;;)  7. if(i > --j) break tp;  8. }  9. system.out.printIn(“i = ” + i + “, j = “+ j);  10. }  11. }   What is the result?()  

  • A、 The program runs and prints “i=1, j=0”
  • B、 The program runs and prints “i=1, j=4”
  • C、 The program runs and prints “i=3, j=4”
  • D、 The program runs and prints “i=3, j=0”
  • E、 An error at line 4 causes compilation to fail.
  • F、 An error at line 7 causes compilation to fail.

正确答案:A

第7题:

public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()  

  • A、 The program runs and prints “0”
  • B、 The program runs and prints “1”
  • C、 The program runs but aborts with an exception.
  • D、 An error “possible undefined variable” at line 4 causes compilation to fail.
  • E、 An error “possible undefined variable” at line 9 causes compilation to fail.

正确答案:B

第8题:

public class foo {   public static void main (stringargs)   try {return;}   finally {system.out.printIn(“Finally”);}   }     What is the result?()  

  • A、 The program runs and prints nothing.
  • B、 The program runs and prints “Finally”
  • C、 The code compiles, but an exception is thrown at runtime.
  • D、 The code will not compile because the catch block is missing.

正确答案:B

第9题:

public class X {   public static void main (Stringargs) {   String s1 = new String (“true”);   Boolean b1 = new Boolean (true);   if (s2.equals(b1)) {   System.out.printIn(“Equal”);   }   }   }   What is the result? () 

  • A、 The program runs and prints nothing.
  • B、 The program runs and prints “Equal”
  • C、 An error at line 5 causes compilation to fail.
  • D、 The program runs but aborts with an exception.

正确答案:A

第10题:

 public class Test {  public static void replaceJ(string text)  {  text.replace (‘j’, ‘l’);  }  public static void main(String args[])  {  string text = new String (“java”)  replaceJ(text);  system.out.printIn(text);  }  }      What is the result?()  

  • A、 The program prints “lava”
  • B、 The program prints “java”
  • C、 An error at line 7 causes compilation to fail.
  • D、 Compilation succeeds but the program throws an exception.

正确答案:B

更多相关问题