I'm trying to display all of the songs that appear in one text file but not another. However it doesn't display any songs. All help appreciated.
My Code:
public static void OnlyInIrishCharts()throws IOException { String lineFromFile, line; String result; String words []; String peices []; int count = 1; boolean found; result = "The following singles only appear in the Irish Charts: "; File f1 = new File("IrishTop100Singles.txt"); File f2 = new File("UKTop100Singles.txt"); if (f1.exists() && f2.exists()) { Scanner input = new Scanner(f1); while(input.hasNext()) { lineFromFile = input.nextLine(); words = lineFromFile.split(";"); Scanner input2 = new Scanner(f2); found = false; while(input2.hasNext() && !found) { line = input2.nextLine(); peices = line.split(";"); if(!(words[2].equals(peices[2])) && !(words[3].equals(peices[3]))) found = true; } input2.close(); if (found = false) { result += (count + ". Title: " + (words[2]) + " Artist: " + (words[3]) + "\n"); count++; } } JOptionPane.showMessageDialog(null,result,"UK and Irish Charts",1); input.close(); } else JOptionPane.showMessageDialog(null,"File Not Found!", "Error!",0); }