代码标红部分,写两遍为什么会报错(Exception in thread "main" java.io.EOFException
at java.io.DataInputStream.readInt(Unknown Source)
at DataStreamDemo.readData(DataStreamDemo.java:30)
at DataStreamDemo.main(DataStreamDemo.java:8))
import java.io.*;
class DataStreamDemo
{
public static void main(String[] args) throws Exception
{
//writeData();
readData();
}
public static void writeData() throws Exception
{
DataOutputStream dos=new DataOutputStream(new FileOutputStream("data.txt"));