I made a class called Subject. The class consists of these lines:
class Subject {
int serial;
Double credit, gpa, tgpa = 0.0;
public Subject(int serial, Double credit, Double gpa, Double tgpa) {
this.serial = serial;
this.credit = credit;
this.gpa = gpa;
this.tgpa = tgpa;
}
public int getSerial() {
return serial;
}
public void setSerial(int serial) {
this.serial = serial;
}
public Double getCredit() {
return credit;
}
public void setCredit(Double credit) {
this.credit = credit;
}
public Double getGpa() {
return gpa;
}
public void setGpa(Double gpa) {
this.gpa = gpa;
}
public Double getTgpa() {
return tgpa;
}
public void setTgpa(Double tgpa) {
this.tgpa = tgpa;
}
}
I'm trying to create two methods for Saving the ArrayList of Subject into a file and Reopen it as an ArrayList of Subject. Any solution?