public class ChangeStrDemo public static void changeStr(String str)str=welcome
举一反三
- public class ChangeStrDemo { public static void changeStr(String str){ str="welcome"; } public static void main(String[] args) { String str="home"; changeStr(str); System.out.println(str); } }给出程序的运行结果( )
- 下面程序段的输出结果是 public class A{ public static void main(String args[]) { String str ="Hello,"; str=str+"Guys!"; System.out.println(str); } }
- 阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果并分析出现此结果的原因。否则请说明编译失败的原因。[br][/br]public class Example {[br][/br] public static void changeStr(String str) {[br][/br] str = str.substring(1,4);[br][/br] }[br][/br] public static void main(String[] args) {[br][/br] String str = "welcome";[br][/br] changeStr(str);[br][/br] System.out.println(str);[br][/br] }[br][/br]}
- 下列程序的运行结果是()public class Test {public static void main(String[] args) {String str = NULL;System.out.println(str);}} A:
- 有如下代码: public class Test{ public static void main(String args[]) { String str = new String("World"); char ch[] = {'H','e','l','l','o'}; change(str,ch); System.out.println(str + "and" + ch); } public static void change(String str, char ch[]) { str = "Changed"; ch[0] = 'C'; } } 运行后输出的结果是: