已知 sb 为 StringBuffer 的一个实例,且 sb.toString() 的值为 "abcde ", 则执行sb. reverse()后,sb.toString()的值为【】
已知 sb 为 StringBuffer 的一个实例,且 sb.toString() 的值为 "abcde ", 则执行sb. reverse()后,sb.toString()的值为【】
下面的程序功能是实现字符串大小写的转换并倒序输出。public static void Main(string[] args){ string str = "HelloWorld"; ______ sb=new StringBuilder(); for (int i = 0; i &lt; str.______ ; i++) { if (str[i] >= 'a' && str[i] <= 'z') { sb.Append( str[i].ToString().ToUpper()); } else { sb.Append( str[i].ToString().______ ()); } } Console.WriteLine(sb.ToString()); Console.ReadKey();}[/i][/i][/i][/i]
下面的程序功能是实现字符串大小写的转换并倒序输出。public static void Main(string[] args){ string str = "HelloWorld"; ______ sb=new StringBuilder(); for (int i = 0; i &lt; str.______ ; i++) { if (str[i] >= 'a' && str[i] <= 'z') { sb.Append( str[i].ToString().ToUpper()); } else { sb.Append( str[i].ToString().______ ()); } } Console.WriteLine(sb.ToString()); Console.ReadKey();}[/i][/i][/i][/i]
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("abcd"); sb.reverse(); System.out.println( sb.toString() ); } } 代码的输出结果是: dcba
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("abcd"); sb.reverse(); System.out.println( sb.toString() ); } } 代码的输出结果是: dcba
下面代码段输出的结果是( )StringBuffer sb = new StringBuffer("huangjianfeng");sb.delete(1,3);System.out.println(sb.toString()); A: ngjianfeng B: hgjianfeng C: hngjianfeng D: hjianfeng
下面代码段输出的结果是( )StringBuffer sb = new StringBuffer("huangjianfeng");sb.delete(1,3);System.out.println(sb.toString()); A: ngjianfeng B: hgjianfeng C: hngjianfeng D: hjianfeng
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("jack"); sb.append(true); sb.append('a'); sb.append(97).append(34.0).append(new char[]{'A','B'}); // 链式编程 System.out.println( sb.toString() ); // 输出缓冲区的中文本数据 sb = new StringBuffer("jack"); sb.insert( 2, "java" ); System.out.println( sb.toString() ); } } A: jacktruea9734.0AB jjavaack B: jacktruea9734.0AB jajavack C: jacktrueaa34.0AB jajavack D: jacktruea9734AB jajavack
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("jack"); sb.append(true); sb.append('a'); sb.append(97).append(34.0).append(new char[]{'A','B'}); // 链式编程 System.out.println( sb.toString() ); // 输出缓冲区的中文本数据 sb = new StringBuffer("jack"); sb.insert( 2, "java" ); System.out.println( sb.toString() ); } } A: jacktruea9734.0AB jjavaack B: jacktruea9734.0AB jajavack C: jacktrueaa34.0AB jajavack D: jacktruea9734AB jajavack
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("hello world"); sb.delete(6,sb.length()); System.out.println( sb.toString() ); } } A: Hello w B: Hello C: Hello worl
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("hello world"); sb.delete(6,sb.length()); System.out.println( sb.toString() ); } } A: Hello w B: Hello C: Hello worl
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("hello world"); sb.replace(6, sb.length(), "java"); System.out.println( sb.toString() ); } } 选择正确的运行结果 A: hello javad B: hellojava C: hello java
class Test { public static void main(String[] args) { StringBuffer sb = new StringBuffer("hello world"); sb.replace(6, sb.length(), "java"); System.out.println( sb.toString() ); } } 选择正确的运行结果 A: hello javad B: hellojava C: hello java
(6-9)请阅读程序,写出程序运行结果。 class Phone{ private String name; private int price; public Phone(String name, int price) { this.name = name; this.price = price; } public String toString() { return ""+this.price; } } public class PhoneDemo { public static void main(String[] args) { StringBuffer sb=new StringBuffer(); Phone [] list=new Phone[3]; list[0]=new Phone("华为",3000); list[1]=new Phone("小米8",4000); list[2]=new Phone("vivo R10",2300); for(Phone p:list) sb.append(p); System.out.println(sb.toString()); } }
(6-9)请阅读程序,写出程序运行结果。 class Phone{ private String name; private int price; public Phone(String name, int price) { this.name = name; this.price = price; } public String toString() { return ""+this.price; } } public class PhoneDemo { public static void main(String[] args) { StringBuffer sb=new StringBuffer(); Phone [] list=new Phone[3]; list[0]=new Phone("华为",3000); list[1]=new Phone("小米8",4000); list[2]=new Phone("vivo R10",2300); for(Phone p:list) sb.append(p); System.out.println(sb.toString()); } }
下面是一段javabean 程序,该程序的运行结果是 ( ) 。public class NullTest{public static void main(String[] args){int M = 0;String str = null;StringBuffer sb = new StringBuffer(“= “);sb.append(str);sb.append(M++);System.out.println(sb.toString());}} A: =null B: =null0 C: =null1 D: =nullM
下面是一段javabean 程序,该程序的运行结果是 ( ) 。public class NullTest{public static void main(String[] args){int M = 0;String str = null;StringBuffer sb = new StringBuffer(“= “);sb.append(str);sb.append(M++);System.out.println(sb.toString());}} A: =null B: =null0 C: =null1 D: =nullM
填入适当的介词 deprive sb ________ sth rob sb _______ sth remind sb _______ sth notify sb _______ sth accuse sb ________ sth
填入适当的介词 deprive sb ________ sth rob sb _______ sth remind sb _______ sth notify sb _______ sth accuse sb ________ sth