标签:数据类型 直接 enc type str eth class [] print
public class TestReferenceType {
public static void main(String[] args) {
Student student = new Student();
student.id = 2000;
method(student);
System.out.println("main:" + student.id);//2000
}
// 引用数据类型直接传类和引用变量
public static void method(Student student) {
student.id = 1000;
System.out.println(student.id);//1000
}
}
结果:
1000
main:1000
标签:数据类型 直接 enc type str eth class [] print
原文地址:https://www.cnblogs.com/Koma-vv/p/9503248.html