In Java FileWriter and FileReader, Is it possible to use object?
<p>Please consider these codes: Is it possible to use FileWriter and FileReader with object of class student?</p>

<pre><code>Student s1 = new Student();
s1.input();//I want to write this method in a File
FileWriter out2 = new FileWriter("input.txt");
out2.write();
out2.flush();
out2.close();

s1.display();//I want to Read this method in a File
FileReader in2 = new FileReader("input.txt");
in2.read(); 
in2.close(); 
</code></pre>