I have the following class
public class Patient implements Serializable {
private int id;
private String name;
private String desc;
public Patient(int id, String name, String desc) {
this.id = id;
this.name = name;
this.desc=desc;
}
And then the following getter and setter methods in this class.
Declaring the arraylist
ArrayList<Patient> list = new ArrayList<Patient>();
Adding run time data in the list
list.add(new Patient(id++, name.getText(), disDesc.getText())
Now i want the read the elements stored in the list How can i do that?
System.out.println(list.get(0));
I use this but it returns the object address of the class