Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void EscriureFitxer(String nom,String cognom1,String cognom2,String dni,File FILE_NAME,ArrayList<Alumne> list){
- Alumne a = new Alumne (nom,cognom1,cognom2,dni);
- list.add(a);
- ObjectOutputStream objectOutput = null;
- try {
- objectOutput = new ObjectOutputStream(new FileOutputStream(FILE_NAME));
- objectOutput.writeObject(list);
- System.out.println("S'ha generat el fitxer " + FILE_NAME);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if(objectOutput != null) {
- try {
- objectOutput.close();
- } catch (IOException ignored) {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement