public static void main(String[] args) { System.out.println("Begin"); Scanner scanner = new Scanner(System.in); String file1 = scanner.nextLine(), file2 = scanner.nextLine(); BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(file1)))); while (reader.ready()) { allLines.add(reader.readLine()); } reader.close(); reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(file2)))); while (reader.ready()) { forRemoveLines.add(reader.readLine()); } reader.close(); Solution solution = new Solution(); solution.joinData(); } catch (FileNotFoundException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } catch (IOException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } }