I'm trying to save an object, I googled the HowTo and got a tutorial on this issue. However since I never worked before with this I'm experiencing problems I can't resolve.
So I have a huge class Course
(contains all sort of things, variables, collectors...) which I'm trying to save in a file.
import java.io.Serializable;
class Person implements Serializable {
... }
Now, I send an object to a class Save.java and try to save it :
class Save {
protected void saveCourse (Course course) {
FileOutputStream courseFile = new FileOutputStream("course.data");
ObjectOutputStream courseObj = new ObjectOutputStream(courseFile);
courseObj.writeObject(course);
}
}
When I try to compile it FileOutputStream and ObjectOutputStream "cannot be resolved to a type". Aren't they suppose to be predefined. How can I fix this
Tutorial where I got this can be found here.