Lets say you have those methods :
public static void listAdd(List<Integer> list){
list.add(123);
list.add(123);
list.add(234);
}
static void compute(String s){
switch(s){
case "1" : s ="other";
break;
case "test" : s ="2222";
break;
default : s ="none";
}
System.out.println("my value inside is none:" + s);
}
Then inside my main i will call both of them:
listAdd(list);
System.out.println(list.size());
String var = "helloworld";
compute(var);
System.out.println(var);
Why does size return 3 [inserted 3 elements changed the list] but my string doesnt change?
3 (outside static) none (system out inside static) helloworld (outside static)