I am creating one application in Java swing api. I am using txt file as my database to store,update etc. I completed storing procedure successfully. But I cant update .If I click update button on my application the data in file could not be replaced. can you please tel me how to replace a data in file?
Thanks in advance...
import java.io.*;
public class test {
public static void main(String args[]) {
try {
String data = null;
File file = new File("student.txt", true);
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
while ((data = br.readLine()) != null) {
String[] de = data.split(" ");
if (de[0].equals("vimal")) {
data.trim();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}