• 2022-06-19
    下列程序的运行结果是()public class Test {public static void main(String[] args) {String str = NULL;System.out.println(str);}}
    A:
  • B

    内容

    • 0

      下面是一段javabean 程序,该程序的运行结果是 ( ) 。public class NullTest{public static void main(String[] args){int M = 0;String str = null;StringBuffer sb = new StringBuffer(“= “);sb.append(str);sb.append(M++);System.out.println(sb.toString());}} A: =null B: =null0 C: =null1 D: =nullM

    • 1

      给定以下代码,程序的运行结果是 ()public class Example {String str=new String("good");char [] ch={'a','b','c'};public static void main(String[] args) {Example ex=new Example();ex.change(ex.str, ex.ch);System.out.print(ex.str+"and");System.out.print(ex.ch);}public void change(String str,char ch[]){str="test ok";ch[0]='g';}} A: goodandabc B: goodandgbc C: test okandabc D: test okandgbc

    • 2

      下列代码执行结果是?( ) class HelloWorld { public static void modifyString(final String str) { str = "Hello World!"; } public static void main(String[] args) { String a = new String("Hello Java"); modifyString(a); System.out.println(“a = ” + a); } } A: a = Hello Java B: a = Hello World C: 代码编译错误 D: 运行时异常

    • 3

      以下程序运行结果为? public class Q { public static void main(String argv[]) { String  a[]= new String[5]; System.out.println(a[0]); } }

    • 4

      public class Test{ public static void main(String[] args){ System.out.println(5/2); } }