s和s2的值分别是什么?string s;int main(){string s2;
解答:[br][/br]s和s2的值均为空字符串。
举一反三
- 以下程序的输出结果是 String s1="1",s2="2"; String s=s1+s2; System.out.println(s);
- 下面的代码片段中正确的是那一项? A: String s=″你好″;int i=3;i+=s; B: String s=″你好″;int i=3;if(i==s){s+=i}; C: String s=″你好″;int i=3;s=i+s; D: String s=″你好″;int i=3;s=i+;
- public static void main(String[] args) { LinkedList list=new LinkedList(); list.add("A"); list.add("B"); String s=(String)list.get(2); System.out.println(s); } 编译运行的结果是
- 下面的表达式( )是错误的。 A: String s=null; int i=(s!=null)&&(s.length()>0)?s.length():0; B: String s="你好";int i=3; if(i==s){ s+=i}; C: String s="你好";int i=3; s=i+s; D: String s="你好";int i=3; s+=i;
- 已知:String s = "AB12ab12";String s1= s.replace("12","CD");String s2= s.replaceAll("12","CD");则s1、s2的值分别为: A: ABCDab12, ABCDabCD B: ABCDabCD, ABCDab12 C: AB12abCD, ABCDab12 D: ABCDabCD, ABCDabCD
内容
- 0
以下要输出“hello,world!”正确的是? A: String s=String.format("%1s%2s","hello","world");System.out.println(s); B: String s=String.format("%1$s,%2$s","hello","world");System.out.println(s); C: String s=String.format("%s,%s","hello","world");System.out.println(s); D: String s=String.format("%1s,%2s","hello","world");System.out.println(s);
- 1
设s="abcd",s1="123",则执行语句s2=InsStr(s,2,s1)后,s2=()
- 2
设有以下定义,则数组s1和s2()。char s1[]={ S ,t, r ,i,n, g};char s2[]= String;
- 3
设字符串S1=“ABCDEFG”,S2=“PQRST”,则运算:S= Concat(Substr(S1,1,LEN(S2)),Substr(S1,LEN(S2),2));后的串值为
- 4
设字符串S1= “ABCDEF”,S2= “PQRS”,则运算S=CONCAT(SUB(S1,2,LEN(S2)),SUB(S1,LEN(S2),2))后的串值为