Subtract one CSV from another in Java

Use the following code to subtract a CSV file from Another CSV file.

How to use the following program
File to subtract: file1.csv (input)
File from which to subtract: file2.csv (input)
New file: p3lang.csv (output)


  • Rohin

    Hey Abhishek,

    You must provide the complete working program (to download) of the above post.

    Thanks in advance!

    • Hi Rohin Saini,

      There is nothing complex that it requires a download link. Just copy it and it will work for you.
      Please let me know if you further face any problem. Happy to help

  • HelpPlease

    I get a problem on line 45 about incompatible type error, with the String.

    • Hi,
      The post has been updated. Thank u for identifying the error.
      The following lines are updated

  • ashu

    found : java.lang.object
    required: java.lang.String

    for(String bs:al2)

    note: uses unchecked or unsafe operations.
    note: Recompile with -xlint: unchecked for details.

    this is the error i am getting while compiling this code

    • Hi Ashu,

      It is giving you the warning.
      I think you are using CMD to compile the program.
      use command:

      It will show you the warnings.
      I have updated the 12th & 13th line again to resolve this.
      Thanx :)