📅  最后修改于: 2022-03-11 14:56:43.910000             🧑  作者: Mango
class Student { int age; Student(int age) { this.age = age; } } public class TestClass { public static void main(String[] args) { Student s1 = new Student(3); Student[] sa = go(s1, new Student(5)); sa[0] = s1; for(Student s : sa) { System.out.print(s.age + " "); } } static Student[] go(Student s1, Student s2) { s1.age = 2; Student[] sa = {s2, s1}; return sa; } }