- class Test
- {
- public static void main(String[] args)
- {
- String s1 = "java";
- String s2 = "hello";
- method_1(s1,s2);
- System.out.println(s1+"...."+s2);
- }
- public static void method_1(String s1,String s2)
- {
- s1.replace('a','k');
- s1 = s2;
- }
- }
复制代码
输出的结果是 java....hello ,method_1方法怎么没有起作用? |
|