[单选题]

有下列程序段 public class fun { public static void main(String args[]) { char b[]="Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是( )。

A.Hello, you

B.Hello0you

C.Hello

D.0

参考答案与解析:

相关试题

有下列程序段public class fun{public static voi

[单选题]有下列程序段 public class fun { public static void main(String args[]) { char b[] = "Hello,you"; b[5] = 0; System.out.println(s); } 执行此程序后,得到的输出结果是( )。A.Hello,youB.Hello0youC.HelloD.0

  • 查看答案
  • 有如下程序: public class Sun{public static vo

    [单选题]有如下程序: public class Sun { public static void main(String args[ ]) { int s=0; int i=1; while (i<=100) { s=s+i; } System.out.println(s); } } 运行后的结果是( )。A.5050B.5051C.死循环,直到溢出D.无穷大的数

  • 查看答案
  • public class Something {public static vo

    [试题]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 Something {public static vo

    [试题]public class Something {public static void main(String[] args) {Something s = new Something();System.out.println("s.doSomething() returns " + doSomething());}public String doSomething() {return "Do something ...";}}看上去很完美。

  • 查看答案
  • public class Something {public static vo

    [试题]public class Something {public static void main(String[] args) {Something s = new Something();System.out.println("s.doSomething() returns " + doSomething());}public String doSomething() {return "Do something ...";}}看上去很完美。

  • 查看答案
  • public class Something {public static vo

    [试题]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 Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)<15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。A.4B.17C.18D.0.25

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=(int)Math.sqrt(2)/2+(int)Math.random()*2/2; y=(int)Math.sqrt(3)/3+(int)Math.random()*3/3; if (x>y) System.out.println("x>y"); else if (x==y) System.out.println("x=y")

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main (String args[ ]) { int x,y; x= (int) Math.sqrt (2) /2+ (int) Math.random ()*2/2; y= (int) Math.sqrt (3) /3+ (int) Math.random ()*3/3; if (x>y) System.out.println ("x>y"); else if (x==y) System.out.

  • 查看答案
  • 设有如下程序:public class Sun{public static vo

    [单选题]设有如下程序: public class Sun { public static void main(String args[ ]) { int x, y; x-4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)<15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。A.4B.17C.18D.0.25

  • 查看答案
  • 有下列程序段public class fun{ public static vo