下面程序的运行结果是什么( )
public static void main(String[] args){
String s1 = “abc”;
String s2 = “xyz”;
show(s1,s2);
System.out.println(s1+”-----”+s2);
}
static void show(String s1,String s2){
s1 = s2+s1+”Q”;
s2 = “W”+s1;
}
-
下面程序的运行结果是什么?() public static void main(String[] args){ String s1 = “abc”; String s2 = “xyz”; show(s1,s2); System.out.println(s1+”-----”+s2); } public static void show(String s1,String s2){ s1 = s2+s1+”Q”; s2 = “W”+s1; }
2021-11-28 关注 0 浏览275 1答案
-
关于以下程序段,正确的说法是:1 String s1=”abc”+”def”;2 String s2=new String(s1);3 if(s1==s2)4 System.out.println(“= = succeeded”);5 if (s1.equals(s2))6 System.out.println(“.equals() succeeded”);
2022-05-10 关注 0 浏览38 1答案
-
写出下面程序的运行结果() class Demo04 { String s = "Outer"; public static void main (String[] args) { S2 s2 = new S2(); s2.display(); } } class S1 { String s = "S1"; public void display(){ System.out.println(s); } } class S2 extends S1 { String s = "S2"; }
2022-03-01 关注 0 浏览92 1答案
-
有如下代码段,请问下面选项结果为false的是:String s1 = “abc”;String s2 = s1;String s3 = new String(“abc”);
2022-05-10 关注 0 浏览46 1答案
-
应用程序的main方法中有以下语句,则输出的结果是:String s1=new String("abc");String s2=new String("abc");boolean b1=s1.equals(s2);boolean b2=(s1==s2);System.out.print(b1+" "+b2);
2022-05-10 关注 0 浏览39 1答案
-
以下代码的执行结果是: public class Example { String s = "Outer"; public static void main(String[] args) { S2 s2 = new S2(); s2.display(); } } class S1 { String s = "S1"; void display() { System.out.println(s); } } class S2 extends S1 { String s = "S2"; }
2020-12-25 关注 0 浏览162 1答案
-
以下代码的执行结果是: public class Example { String s = "Outer"; public static void main(String[] args) { S2 s2 = new S2( ); s2.display( ); } } class S1 { String s = "S1"; void display( ) { System.out.println(s); } } class S2 extends S1 { String s = "S2"; }
2020-12-25 关注 0 浏览233 1答案
-
以下代码的执行结果是: public class Example { String s = "Outer"; public static void main(String[] args) { S2 s2 = new S2(); s2.display(); } } class S1 { String s = "S1"; void display() { System.out.println(s); } } class S2 extends S1 { String s = "S2"; }
2020-12-30 关注 0 浏览89 1答案
-
有如下代码段,请问下面选项结果为false的是:String s1 = “abc”;String s2 = new String(“abc”);String s3 = new String(“abc”);
2022-05-10 关注 0 浏览31 1答案
-
有以下程序void swap(char *x,char *y){char t;t=*x; *x=*y; *y=t;}main(){char *s1="abc",*s2="123";swap(s1,s2);printf("%s,%s\n",s1,s2);}程序执行后的输出结果是
2022-05-11 关注 0 浏览28 1答案