Java IO -- 序列化的疑问

public static void main(String[] args) throws FileNotFoundException, IOException
    {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("C:\\stream.txt") );
            
    }


没有对oos进行任何write操作,仅仅赋值而已,为什么在stream.txt.里已经有内容写入?

我用FileInputStream读出数据如下

public static void main(String[] args) throws IOException, ClassNotFoundException{


        File file = new File("C:\\stream.txt");
			FileInputStream is = new FileInputStream(file);
			byte[] b = new byte[50];
			is.read(b);
			for(byte bb : b)
			{
				System.out.println(bb);
			}
}

 结果输出是

-84
-19
0
5

有研究者能解答这个问题麽?

原文地址:https://www.cnblogs.com/chenyao/p/2995549.html