How to write an array of objects to a File in Java?
<p>Suppose I have an object of class <code>Student</code>, which has the following fields:</p>

<pre><code>String name;

int age;

int roll_number;
</code></pre>

<p>And I instantiate like so: </p>

<pre><code>Student A[] = new Student();
</code></pre>

<p>Now, is there a way to store all this information in a text file using File Handling?</p>

<p>I thought about looping through each element in the array and then converting all the fields into Strings but that seems wrong.</p>