string作为参数传递 day11

package com.shujia.day11;

public class string {
    public static void main(String[] args) {
        String s1 = "hello";
        String s2 = "world";
        System.out.println("s1: " + s1 + ", s2: " + s2);
        fun1(s1, s2);
        System.out.println("s1: " + s1 + ", s2: " + s2);
    }

    public static void fun1(String s1, String s2) {
        s1 = s2;
        s2 = s1 + s2;
        System.out.println("s1: " + s1 + ", s2: " + s2);

    }
}

posted @ 2024-08-08 22:41  ていせい  阅读(4)  评论(0编辑  收藏  举报