I am newbie in the java programming. Here I got a question since I don't know how to change the text in the text file. How to change the String pass in notepad. I am trying to insert a new password in password field which in order to change(pass) that is password in my text file.
public void actionPerformed(ActionEvent e) {
String inputUser = input1.getText();
String inputPass = input2.getText();
File loginf = new File("oop.txt");
if(e.getSource() == returnLP) {
TrialGUI link = new TrialGUI();
dispose();
}
try {
if(e.getSource()==reset) {
FileWriter fstream = new FileWriter("oop.txt");
BufferedWriter out = new BufferedWriter(fstream);
Scanner read = new Scanner(new File("oop.txt"));
while(read.hasNext()) {
String user = read.next();
String pass = read.next();
if(inputUser.equals(user)){
break;
}
}
read.close();
} catch(Exception e) {
e.printStackTrace();
}
}