I am in trouble finding how to read a text file and then write a new line after the ones that were before on the file.
Like (current file)
1234 Albert
(edited file)
1234 Albert
1223 Dave
for this, i am using this code without success.
   String suma="";
   String verify="";
        BufferedReader br=new BufferedReader(new FileReader("C:\\Users\\Beto\\Desktop\\registrocuentas.txt"));
        BufferedWriter bw= new BufferedWriter(new FileWriter("C:\\Users\\Beto\\Desktop\\registrocuentas.txt")); 
        while((verify=br.readLine())!=null){
            suma=suma+" "+verify;
            System.out.println(suma);
        }
        suma=suma+" "+cuenta+"."+nombre+apellidoPaterno+apellidoMaterno;
        String split[]=suma.split(" ");
        int c=split.length;
        for(int i=0;i<c;i++){
            bw.write(split[i]);
        }
        bw.close();
        br.close();
Currently the edited file erases the old entry, making the file looks like this
(current result of my code for edited file)
1223 Dave
 
     
     
    