package javaapplication1;
public class PassString {
public static void main(String[] args) {
String name = "Shakespeare";
System.out.println("In main, the name is "
+ name);
changeName(name); // i don't get why we pass name as an argument
System.out.println("Back in main, the name is "
+ name);
}
public static void changeName(String str) {
str = "Dickens";
System.out.println("In changeName, the name " + "is now "
+ str);
}
}
changeName メソッドで名前を引数として渡す目的がわかりません。String name = "Shakespeare"; に何らかの形で関連していますか?