Untitled

 avatar
unknown
java
a month ago
622 B
3
Indexable
public class Test{
    static void changeX(String x){
        x = "0";

    }
    static void changeY(MyString y){
        y.s = "20";
    }
    static class MyString{
        String s;
        MyString(String s){
            this.s = s;
        }
    }
    public static void main(String[] args) {
        String x = "2";
        System.out.println(x);
        changeX(x);
        System.out.println(x);
        MyString y = new MyString("22");
        System.out.println(y.s);
        changeX(y.s);
        System.out.println(y.s);
        changeY(y);
        System.out.println(y.s);
    }
}
Leave a Comment