Hi, I have a class with information about a Person. Something like:
public class Contact {
private String name;
private String location;
private String address;
private String email;
private String phone;
private String fax;
public String toString() {
// Something here
}
// Getters and setters.
}
I want toString to return: this.name +" - "+ this.locations ... with every var.
I was trying to do it using reflection the way I read from this question but I can't manage to print instance vars.
Which is the correctly way to solve this?
Thanks for reading!