java自学,对两个文本内容比较如果一样就打印成功,不一样就打印错误。但是我这只会输出打印成功



```java
import java.io.FileInputStream;

public class Tiqu {
    public static void main(String[] args) {
        StringBuilder s1=null;
        StringBuilder s2=null;
        try {
            FileInputStream in = new FileInputStream("D:\\eclipse\\lianxi\\day19\\src\\day10\\haha1.txt");
            byte[] b = new byte[100];
            int len = 0;
            while ((len = in.read(b)) != -1) {
                s1.append(new String(b, 0, len));
            }
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            FileInputStream in1 = new FileInputStream("D:\\JAVA\\haha2.txt");
            byte[] b = new byte[100];
            int len = 0;
            while ((len = in1.read(b)) != -1) {
                s2.append(new String(b, 0, len));
            }
            in1.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if(s1!=s2){
            System.out.println("密码错误");
        }else{
            System.out.println("打印成功");
        }
    }

}

```

32行修改如下:
if(s1.toString().equals(s2.toString())){
}