单选题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?()AThe program runs and prints nothin

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


相似考题
更多“单选题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 noth”相关问题
  • 第1题:

    Which declarations will allow a class to be started as a standalone program?()  

    • A、public void main(String args[])
    • B、public void static main(String args[])
    • C、public static main(String[] argv)
    • D、final public static void main(String [] array)
    • E、public static void main(String args[])

    正确答案:D,E

  • 第2题:

    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.printIn (textString + textBuffer);    }   )   What is the output?()


    正确答案:javajavaC

  • 第3题:

    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

  • 第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 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

  • 第6题:

    public class Test{ public static void main(String[]args){ intx=5; boolean b1=true; boolean b2=false; if((x==4)&&!b2) System.out.print("l"); System.out.print("2"); if((b2=true)&&b1) System.out.print("3"); } } What is the result?()

    • A、2
    • B、3
    • C、12
    • D、23
    • E、123
    • F、Compilation fails.
    • G、An exceptional ist hrown at runtime.

    正确答案:D

  • 第7题:

    填空题
    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.printIn (textString + textBuffer);    }   )   What is the output?()

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

  • 第8题:

    单选题
    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
    解析: 暂无解析

  • 第9题:

    单选题
    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
    解析: 暂无解析

  • 第10题:

    单选题
    public class Test{ public static void main(String[]args){ intx=5; boolean b1=true; boolean b2=false; if((x==4)&&!b2) System.out.print("l"); System.out.print("2"); if((b2=true)&&b1) System.out.print("3"); } } What is the result?()
    A

    2

    B

    3

    C

    12

    D

    23

    E

    123

    F

    Compilation fails.

    G

    An exceptional ist hrown at runtime.


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

  • 第11题:

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


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

  • 第12题:

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


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

  • 第13题:

    public class Alpha{  public static void main( string[] args ){  if ( args.length == 2 ) {  if ( args.[0].equalsIgnoreCase(“-b”) )  System.out.println( new Boolean( args[1] ));  }  }  }   And the code is invoked by using the command: java Alpha –b TRUE   What is the result?()  

    • A、 true
    • B、 null
    • C、 false
    • D、 Compilation fails.
    • E、 The code runs with no output.
    • F、 An exception is thrown at runtime.

    正确答案:A

  • 第14题:

    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

  • 第15题:

    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

  • 第16题:

    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.

    正确答案:B

  • 第17题:

     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

  • 第18题:

    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.

    正确答案:B

  • 第19题:

    单选题
    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
    解析: 暂无解析

  • 第20题:

    单选题
    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
    解析: 暂无解析

  • 第21题:

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


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

  • 第22题:

    单选题
    public class Alpha{  public static void main( string[] args ){  if ( args.length == 2 ) {  if ( args.[0].equalsIgnoreCase(“-b”) )  System.out.println( new Boolean( args[1] ));  }  }  }   And the code is invoked by using the command: java Alpha –b TRUE   What is the result?()
    A

     true

    B

     null

    C

     false

    D

     Compilation fails.

    E

     The code runs with no output.

    F

     An exception is thrown at runtime.


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

  • 第23题:

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


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

  • 第24题:

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


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