How do I print my Java object without getting “SomeType@2f92e0f4”?
问题 I have a class defined as follows: public class Person { private String name; // constructor and getter/setter omitted } I tried to print an instance of my class: System.out.println(myPerson); but I got the following output: com.foo.Person@2f92e0f4 . A similar thing happened when I tried to print an array of Person objects: Person[] people = //... System.out.println(people); I got the output: [Lcom.foo.Person;@28a418fc What does this output mean? How do I change this output so it contains the