class studentCard{
int id;
String name;
int age;
}
public class lesson22{
static void PCI(studentCard card){/*studentCardのインスタンスの参照をcardという変数で受け取る*/
System.out.println("IDは"+card.id);
System.out.println("名前は"+card.name);
System.out.println("年齢は"+card.age);
}
static void CCI(studentCard card){
card.id = 0;
card.name = "未定";
}
public static void main(String[] args) {
studentCard a = new studentCard();
a.id = 1234;
a.name = "KK";
a.age = 18;
PCI(a);
CCI(a);
PCI(a);
}
}
実行結果が
IDは1234 名前はKK 年齢は18
IDは0 名前は未定 年齢は18
こうなるんだが
PCI(a);
CCI(a);
PCI(a);←これが動いてないのはなぜ?