how to validate first the 2 file name, before comparing the content?
<p>this code is used to compare the content of 2 text files,
but i need to validate first, that the names of those 2 file is not same.</p>

<p>can you help me to fix this code?</p>

<pre><code> import java.io.*;
 import java.util.*;

 public class compare { 
    public static void main(String args[]) throws IOException {

      try{
        FileInputStream file1 = new FileInputStream(args[0]);
        FileInputStream file2 = new FileInputStream(args[1]);

        if(args.length != 2)
            throw (new RuntimeException("Usage : java compare &lt;filetoread&gt; &lt;filetoread&gt;"));

        if(args[0]==args[1]){
           System.out.print("File name is identical");
        }
         else {
           while (true) {  
             int a = file1.read();
             int b = file2.read();
             if (a!=b) { 
               System.out.print("File do not match");
               break; 
             }
             else{
               System.out.print("Files match");
               break;
             }
           }
         }
      }
      catch(FileNotFoundException e){
        System.out.print("File tidak ada");
      } 
      catch(IOException e){
        System.out.print("IO Error");
      }
   }
}
</code></pre>
