单选题public class X {   public static void main (Stringargs) {   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 print

题目
单选题
public class X {   public static void main (Stringargs) {   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.


相似考题
更多“单选题public class X {   public static void main (Stringargs) {   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 print”相关问题
  • 第1题:

    下列语句输出结果为( )。 public class test { public static void main(StringArgsl[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); } }

    A.false

    B.true

    C.1

    D.0


    正确答案:B

  • 第2题:

    public class foo {   public static void main (Stringargs) {  String s;   system.out.printIn (“s=” + s);   }   }   What is the result?()

    • A、 The code compiles and “s=” is printed.
    • B、 The code compiles and “s=null” is printed.
    • C、 The code does not compile because string s is not initialized.
    • D、 The code does not compile because string s cannot be referenced.
    • E、 The code compiles, but a NullPointerException is thrown when toString is called.

    正确答案:C

  • 第3题:

    interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?() 

    • A、 s 14
    • B、 s 16
    • C、 s 10
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:D

  • 第4题:

    Given:  310-025   Leading the way in IT testing and certification tools, www.testking.com   - 48 -   public class foo {   static String s;   public static void main (Stringargs) {   system.out.printIn (“s=” + s);   }   }   What is the result?()

    • A、 The code compiles and “s=” is printed.
    • B、 The code compiles and “s=null” is printed.
    • C、 The code does not compile because string s is not initialized.
    • D、 The code does not compile because string s cannot be referenced.
    • E、 The code compiles, but a NullPointerException is thrown when toString is called.

    正确答案:B

  • 第5题:

    public class foo {  static String s;  public static void main (String[]args) {  system.out.printIn (“s=” + s);  } }  What is the result?()  

    • A、 The code compiles and “s=” is printed.
    • B、 The code compiles and “s=null” is printed.
    • C、 The code does not compile because string s is not initialized.
    • D、 The code does not compile because string s cannot be referenced.
    • E、 The code compiles, but a NullPointerException is thrown when toString is called.

    正确答案:B

  • 第6题:

    public class X {  public static void main (String[]args)  {  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

  • 第7题:

    public class X {   public static void main (Stringargs) {   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

  • 第8题:

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


    正确答案: D
    解析: 暂无解析

  • 第9题:

    单选题
    public class X {   public static void main (Stringargs) {   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.


    正确答案: D
    解析: 暂无解析

  • 第10题:

    单选题
    public class foo {  public static void main (String[]args) {  String s;  system.out.printIn (“s=” + s);  }  }   What is the result?()
    A

     The code compiles and “s=” is printed.

    B

     The code compiles and “s=null” is printed.

    C

     The code does not compile because string s is not initialized.

    D

     The code does not compile because string s cannot be referenced.

    E

     The code compiles, but a NullPointerException is thrown when toString is called.


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    public class foo {  static String s;  public static void main (String[]args) {  system.out.printIn (“s=” + s);  } }  What is the result?()
    A

     The code compiles and “s=” is printed.

    B

     The code compiles and “s=null” is printed.

    C

     The code does not compile because string s is not initialized.

    D

     The code does not compile because string s cannot be referenced.

    E

     The code compiles, but a NullPointerException is thrown when toString is called.


    正确答案: B
    解析: 暂无解析

  • 第12题:

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


    正确答案: C
    解析: 暂无解析

  • 第13题:

    下列代码的执行结果是______。 public class ex55 { public static void main(String args[] ) { String s1=new String("hello"); String s2=new String("hello"); System.out.print (s1==s2); System.out.print (","); System.out.println (s1.equals (s2)); } }

    A.true, false

    B.true, true

    C.false, true

    D.false, false


    正确答案:C

  • 第14题:

    public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?() 

    • A、 foofoofoofoofoo
    • B、 foobarfoobarbar
    • C、 foobarfoofoofoo
    • D、 foobarfoobarfoo
    • E、 barbarbarbarbar
    • F、 foofoofoobarbar
    • G、 foofoofoobarfoo

    正确答案:D

  • 第15题:

    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

  • 第16题:

    public class foo {  public static void main (String[]args) {  String s;  system.out.printIn (“s=” + s);  }  }   What is the result?()  

    • A、 The code compiles and “s=” is printed.
    • B、 The code compiles and “s=null” is printed.
    • C、 The code does not compile because string s is not initialized.
    • D、 The code does not compile because string s cannot be referenced.
    • E、 The code compiles, but a NullPointerException is thrown when toString is called.

    正确答案:C

  • 第17题:

    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

  • 第18题:

     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

  • 第19题:

    单选题
    Given:  310-025   Leading the way in IT testing and certification tools, www.testking.com   - 48 -   public class foo {   static String s;   public static void main (Stringargs) {   system.out.printIn (“s=” + s);   }   }   What is the result?()
    A

     The code compiles and “s=” is printed.

    B

     The code compiles and “s=null” is printed.

    C

     The code does not compile because string s is not initialized.

    D

     The code does not compile because string s cannot be referenced.

    E

     The code compiles, but a NullPointerException is thrown when toString is called.


    正确答案: B
    解析: 暂无解析

  • 第20题:

    单选题
    public class X {  public static void main (String[]args)  {  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.


    正确答案: D
    解析: 暂无解析

  • 第21题:

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


    正确答案: B
    解析: 暂无解析

  • 第22题:

    单选题
    public class foo {   public static void main (Stringargs) {  String s;   system.out.printIn (“s=” + s);   }   }   What is the result?()
    A

     The code compiles and “s=” is printed.

    B

     The code compiles and “s=null” is printed.

    C

     The code does not compile because string s is not initialized.

    D

     The code does not compile because string s cannot be referenced.

    E

     The code compiles, but a NullPointerException is thrown when toString is called.


    正确答案: E
    解析: 暂无解析

  • 第23题:

    单选题
    interface DeclareStuff{  public static final int EASY = 3;  void doStuff(int t); }  public class TestDeclare implements DeclareStuff {  public static void main(String [] args) {  int x=5;  new TestDeclare().doStuff(++x);  }  void doStuff(int s) {  s += EASY + ++s;  System.out.println(”s “ + s);  }  }  What is the result?()
    A

     s 14

    B

     s 16

    C

     s 10

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


    正确答案: E
    解析: 暂无解析

  • 第24题:

    单选题
    public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?()
    A

     foofoofoofoofoo

    B

     foobarfoobarbar

    C

     foobarfoofoofoo

    D

     foobarfoobarfoo

    E

     barbarbarbarbar

    F

     foofoofoobarbar

    G

     foofoofoobarfoo


    正确答案: B
    解析: 暂无解析