File contents(string) are same still the result false -


i put in file1 "moonwalk". copies file2. still equals of them false. why?

import java.io.*;  public class test {      public static void main(string[] args) {          string a="";         string copya="";         string ar[] = new string[100];         int n=0;         try{         filereader fr = new filereader("file1.txt");         bufferedreader br = new bufferedreader(fr);         fileoutputstream fos = new fileoutputstream("file2.txt");         printwriter pw = new printwriter(fos,true);           while(a!=null) {               = br.readline();               if(a!=null) {                  system.out.println(a);                  ar[n] = a;                  pw.println(a);                  n++;              }          }         }          catch(exception e){             system.out.println(e.getmessage());         }          system.out.println("\n\n\n\n\n");          ar[n] =null;          for(int i=0; ar[i]!=null;i++){             system.out.println(ar[i]);         }            system.out.println("\n\n\n\n\n");           string br[] = new string[1000];         string b = "";         int m=0;         try{         filereader fr1 = new filereader("file2.txt");         bufferedreader br1 = new bufferedreader(fr1);          while(b!=null){              b = br1.readline();              if(b!=null) {                  system.out.println(b);                 br[m]=b;                 m++;             }         }         }         catch(exception e){             system.out.println(e.getmessage());         }          system.out.println("\n\n\n\n\n");           br[m]=null;          for(int i=0; br[i]!=null;i++) {             system.out.println(br[i]);         }          system.out.println("\n\n\n\n\n");          system.out.println(ar.equals(br));     } } 

i put in file1 "moonwalk". copies file2. still equals of them false. why ?


Comments