请说出E类中标注的【代码1】和【代码2】的输出结果,publicclass E {public static void main(String args[]) {byte d[]="abc我们喜欢篮球".getBytes();System.out.println(d.length); // 【代码1】String s=new String(d, 0, 7);System.out.println(s);// 【代码2】}}【代码1】的输出结果是【代码2】的输出结果是
查看答案
下列程序段执行后的结果是。String s=new String(""abcdefg"");for(int i=0;i<s.length();i+=2){System.out.print(s.charAt(i));}
请简述String类与StringBuffer类的区别
编译和运行下面的应用程序,并在命令行界面输入12345,则回车后屏幕输出的结果是( )public class A {public static void main(String args[]) throws IOException{BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));String str=buf.readLine();int x=Integer.parseInt(str);System.out.println(x/100);}}
A. 45
B. 5
C. 123
D. 12345
下面的程序段执行后输出的结果是( )。StringBuffer buf=new StringBuffer(""Beijing2008"");buf.insert(7,""@"");System.out.println(buf.toString());
A. Beijing@2008
B. @Beijing2008
C. Beijing2008@
D. Beijing
E. 2008