网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

设原字符串s为StringBuffer型,且s="Hellojava",如果想用子串替换把s转换成"HelloWorld",则正确的语句是()

  • A、s.replace(6,9,"World");
  • B、s.replace(6,10,"World");
  • C、s="World";
  • D、s=replace("java","World");

参考答案

更多 “设原字符串s为StringBuffer型,且s="Hellojava",如果想用子串替换把s转换成"HelloWorld",则正确的语句是()A、s.replace(6,9,"World");B、s.replace(6,10,"World");C、s="World";D、s=replace("java","World");” 相关考题
考题 以下说法中错误的是A.strcpy(A,B)函数是将A字符串的内容复制到B字符串中B.strlen(cha*s)返回字符串S的长度,未尾的字符不计算在内C.char a[20]="string";中字符串长度为6D.strstr(S1,S2)函数在字符串S1中从左边开始查找字符串S2,若查找成功则返回S2在S1中首次出现的位置,否则返回NULL,如果S2为"",则返回S1。

考题 设字符串s1='ABCDEFG',s2='PQRST',则运算s=CONCAT(SUB(s1,2,LEN(s2)),SUB(s1,LEN(s2,2))后的串值为(65)。A.'ABCDEFEF'B.'BCDEFG'C.'BCPQRST'D.'BCQR'

考题 已知变量x、y为整数型,且x=4,y=12,s为字符串型,且“s="a"”,Lblok为标签控件,下列赋值语句合法的是______。A.x=Lblok.CaptionB.Lblok.Caption=Str(x)C.x*3=yD.y=x*s

考题 已知变量X、Y为整型,且x=4,y=12,S为字符串型,且s=a,1blok为标签控件,下列赋值语句合法的是( )。A.x=1blok.CaptionB.Lblok.caption=Str(x)C.x*3=yD.Y=x*s

考题 已知变量X、Y为整数型,且x=4,y=12,S为字符串型,且s=a,LblOk为标签控件,下列赋值语句不合法的是( )。A. x=LblOk.CaptionB. LblOk.caption=Str(x)C. x*3=yD. y=x*s

考题 已知变量x,y为整数型,且x=4,y=12,s为字符串型,且s=“a”,lblok为标签控件,下列赋值语句合法的是______。A. x=lblok. CaptionB.Lblok. caption=Str(x)C.x*3=yD.Y=x*s

考题 假定s被定义为指针类型char *的变量,初始指向的字符串为"Hello world!",若要使变量p指向s所指向的字符串,则p应定义为()。Achar *p=s;Bchar *p=s;Cchar *p;p=*s;Dchar *p; p=s;

考题 设char *s1, *s2;分别指向两个字符串,可以判断字符串s1和s2是否相等的表达式为()A、s1=s2B、s1==s2C、strcpy(s1,s2)==0D、strcmp(s1,s2)==0

考题 设字符串S=”Olympic”,S的非字串的数目是()A、28B、29C、16D、17

考题 设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为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?()A、 String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;B、 StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);C、 StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);D、 StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);E、 StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);

考题 设已定义:chars1[20]=”Youare”,s2[9]=”welcome!”;若要形成字符串”Youarewelcome!”,正确的语句是()A、strcat(s1,s2)B、strcpy(s1,s2)C、s1+s2D、s1s2

考题 String与StringBuffer最大的区别在于()A、它们没有区别B、String对原字符串的拷贝进行操作,而StringBuffer对原字符串本事操作C、StringBuffer拥有更多相关函数D、String更节省空间

考题 StringBuffer型字符串是在字符串的拷贝上进行操作

考题 booleanendsWith(Strings)表示()A、查找某字符串是否以s为结尾B、查找某字符串是否与s完全匹配C、确定某字符串与s的大小关系D、确定某字符串是否以s为开始

考题 设字符串S1= “ABCDEF”,S2= “PQRS”,则运算S=CONCAT(SUB(S1,2,LEN(S2)),SUB(S1,LEN(S2),2))后的串值为()。

考题 定义有StringBuffer s1=new StringBuffer(10);s1.append(“1234”)则s1.length()和s1.capacity()分别是多少?A、4;10B、4;4C、10;10D、10;4

考题 public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()A、 The program prints “ABBCAD”B、 The program prints “CDDACB”C、 The program prints “ADCBADBC”D、 The output is a non-deterministic point because of a possible deadlock condition.E、 The output is dependent on the threading model of the system the program is running on.

考题 单选题设字符串S=”Olympic”,S的非字串的数目是()A 28B 29C 16D 17

考题 单选题设原字符串s为StringBuffer型,且s="Hellojava",如果想用子串替换把s转换成"HelloWorld",则正确的语句是()A s.replace(6,9,World);B s.replace(6,10,World);C s=World;D s=replace(java,World);

考题 判断题StringBuffer型字符串是在字符串的拷贝上进行操作A 对B 错

考题 单选题booleanendsWith(Strings)表示()A 查找某字符串是否以s为结尾B 查找某字符串是否与s完全匹配C 确定某字符串与s的大小关系D 确定某字符串是否以s为开始

考题 判断题设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6A 对B 错

考题 单选题String与StringBuffer最大的区别在于()A 它们没有区别B String对原字符串的拷贝进行操作,而StringBuffer对原字符串本事操作C StringBuffer拥有更多相关函数D String更节省空间

考题 填空题设字符串S1= “ABCDEF”,S2= “PQRS”,则运算S=CONCAT(SUB(S1,2,LEN(S2)),SUB(S1,LEN(S2),2))后的串值为()。

考题 单选题设char *s1, *s2;分别指向两个字符串,可以判断字符串s1和s2是否相等的表达式为()A s1=s2B s1==s2C strcpy(s1,s2)==0D strcmp(s1,s2)==0

考题 多选题public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()AThe program prints “ABBCAD”BThe program prints “CDDACB”CThe program prints “ADCBADBC”DThe output is a non-deterministic point because of a possible deadlock condition.EThe output is dependent on the threading model of the system the program is running on.