I have written this bit of code is ArrayList better than Vector and if so how do i change it ????
i am thinking where ever vector is mentioned to change it to ArrayList
import java.util.Vector;
import java.io.*;
public class V_All_Std_Record
{
private Vector main_Vector = new Vector();
public V_All_Std_Record()
{
try
{
File std_File = new File("");
String str = std_File.getAbsolutePath()+"\\Data Files\\Std_Rec.txt";
ObjectInputStream obj_File = new ObjectInputStream(new
FileInputStream(new File(str)));
main_Vector = (Vector)obj_File.readObject();
obj_File.close();
System.out.println(main_Vector);
}
catch(Exception ee)
{
System.out.println("Student Data file not Found or there is no data in it");
}
}
public static void main(String[] args)
{
V_All_Std_Record v_All_Std_Record1 = new V_All_Std_Record();
}
//returns all studentd records
public Vector getAllRecords()
{
return main_Vector;
}
}
Code tags added. -Narue