下列 String 类的() 方法返回指定字符串的一部分(选择一项)
A. extractstring()
B. substring()
C. Substring()
D. Middlestring()
查看答案
对于下列代码:public class Example{String str=new String("hello");char ch[]={'d','b','c'};public static void main(String args[]){Example ex=new Example();ex.change(ex.str,ex.ch);System.out.println(ex.str+" and "+ex.ch[0]);} public void change(String str,char ch[]){str="world";ch[0]= 'a';}}输出的结果是:()
A. hello and d
B. hello and a
C. world and d
D. world and a
给定下列程序:public class Test{public static void main(String args[]){String str=new String("World");char ch[]={'C','e','l','l','o'};change(str,ch);System.out.println(str+"and"+ch);} public static void change(String str,char ch[]){str="Changed";ch[0]='H';
A. World and Cello
B. World and Hello
Changed and Hello
D. Changed and Cello
对于以下声明:String s1="hello";String s2="world";String s3;下面的操作合法的是( )
A. s3=s1+s2;
B. s3=s1-s2;
C. s3=s1&s2;
D. s3=s1&&s2;
下列程序运行的结果为: ( )public class test {public static void main(String args[]) {int i;float f = 2.3f;double d = 2.7;i = ((int)Math.ceil(f)) * ((int)Math.round(d));System.out.println(i);}}
A. 4
B. 5
C. 6
D. 9