This is code that deletes the content of the file then writes on it I want to write in the file without deleting the content and write on the last line
import java.io.*;
import java.util.Scanner;
public class SetValues {
    public void setNumberPhone(String numberPhone) throws UnsupportedEncodingException {
        Scanner input = new Scanner(System.in);
        PrintWriter pr = null;
        try {
            input = new Scanner("C:/Users/Abdalrahman/Desktop/PhoneNumber.txt");
            pr = new PrintWriter("C:/Users/Abdalrahman/Desktop/PhoneNumber.txt", "UTF-8");
        } catch (FileNotFoundException e) {
            System.out.println("Not Open" + e.getMessage());
            System.exit(0);
        }
        if (input.hasNext()) {
            pr.println(numberPhone);
        }
        pr.close();
    }
}
 
     
    