下面程序的输出结果是() public class Test{ public static void main(String[] args){ String s = “abc dsf ghi”; String[] arr = s.split(“/s”); System.out.println(arr.length); } }
第1题:
下面程序执行后的输出结果为( )。 public class fun { public static void main(String args[]) { String greets="How are you!"; String s=greets.substring(0,3); System.out.println(S); } }
A.How
B.are.
C.you
D.how ate you!
第2题:
阅读下面程序
public class Test3{
public static void main(String args[]){
int x=3,y=4,z=5;
String s= " xyz " ;
System.out.println(s+x+y+z);
}
}
程序运行的结果是
A)xyz12
B)xyz345
C)xyzxyz
D)12xyz
第3题:
A.编译报错
B.2
C.1
D.3
第4题:
阅读下面代码 public class Test { String s="One World One Dream"; public static void main(String[] args) { System.out.println(s); } } 其运行的结果是
A.args
B.World One Dream
C.s
D.编译时出错
第5题:
下面程序的输出结果是什么? class Foo{ static void change(String s){ s=s.replace('j','l'); } public static void main(String args[]){ String s="java"; change(s); System.out.println(s); } }()
A.lava
B.java
C.编译错误
D.运行时出现异常
第6题:
在执行下面这段Java程序时: public class Test { public static void main (String[] args) { String s1=args[0]; String s2=args[1]; String s3=args[2]; } }若编译程序后键入命令: java Test one two three,那么变量s1所引用的字符串为( )。
A.null
B.test
C.one
D.java
第7题:
下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }
A.String:String first,int:11
B.int:11,String:Int first
C.String:String first,int99
D.int:99,String:Int first
第8题:
下列程序的运行结果是【 】。
public class Test {
public static void main (String args[]) {
String s1="hello!";
System.out.println (s1.toUpperCase());
}}
第9题:
下列语句输出结果为( )。 public class test\ { public static void main (String args[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1.equals(s2))); } }
A.false
B.true
C.0
D.1
第10题:
下列程序的执行结果是
public class Testee{
public static void main(String args[ ]){
int a=4,b=6,c=8;
String s="abc";
System.out.println(a+b+s+C) ;
}
}
A.ababcc
B.464688
C.46abc8
D.10abc8