I want to compare contens of my two txt files and write the different words in other file3.txt file
I want to do compare method in this way to write another txt file. A
You are opening the third file deneme3.txt
twice without closing it in between. I guess the second time (in write()
) an exception will be thrown, so there will be no write. Remove the first occurence of FileWriter writer = new FileWriter(new File("D:\\Denemeler\\deneme3.txt"));
(the one in compare()
) and you should be fine.