A、Beijing@2008
B、@Beijing2008
C、Beijing2008@
D、Beijing#2008
第1题:
有下列程序段 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
第2题:
有以下程序:
执行后输出结果是 ( )。
A.7
B.6
C.8
D.无确定值
第3题:
有以下程序:执行后的输出结果是( )。
A.7
B.3
C.2 0)O
第4题:
执行下面的程序段,输出结果为______。
publicclassQ
{
publicstaticvoidmain(Stringargv[])
{
intanar[]=newint[5];
System.out.println(anar[0]);
}
}
第5题:
设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6
第6题:
public class TestString3 { public static void main(String[] args) { // insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247?()
第7题:
Public class test ( Public static void stringReplace (String text) ( Text = text.replace („j„ , „i„); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args ){ String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printIn (textString + textBuffer); } ) What is the output?()
第8题:
定义有StringBuffer s1=new StringBuffer(10);s1.append(“1234”)则s1.length()和s1.capacity()分别是多少?
第9题:
Public class test ( Public static void stringReplace (String text) ( Text = text.replace (‘j’ , ‘i’); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args[]} ( String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); bufferReplace (textBuffer); System.out.printLn (textString + textBuffer); ) ) What is the output?()
第10题:
This code is NOT thread-safe.
The programmer can replace StringBuffer with StringBuilder with no other changes.
This code will perform well and converting the code to use StringBuilder will not enhance the performance.
This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;
第11题:
第12题:
对
错
第13题:
执行下列程序后,输出结果为( )。 public class Test { public static void main (String[] args) { StringBuffer sb = new StringBuffer("北京 2008" ); System. out. println ("length =" + sb. length ( ) ); } }
A.length = 8
B.length = 10
C.length = 6
D.length = 20
第14题:
有以下程序:
程序执行后的输出结果是( )。
A.7
B.3
C.2
D.0
第15题:
设已执行预编译命令#include<string.h>,以下程序段的输出结果是( )。 char s[]=" an apple" ; printf(" %d\n" ,strlen(s));
A.7
B.8
C.9
D.10
第16题:
第17题:
字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer(); Integer intObj = new Integer(33);
第18题:
String与StringBuffer的区别()。
第19题:
关于String和StringBuffer,下面那些是正确的:()
第20题:
Given this method in a class: public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(‟<‟); buffer.append(this.name); buffer.append(‟>‟); return buffer.toString(); } Which is true?()
第21题:
以下语句的含义是() char[] arrcrlf={13,10}; String crlf=new String(arrcrlf); stringBuffer dest = new StringBuffer("西行漫记"); dest.append(crlf);
第22题:
15
100
150
10
第23题: