import java.io.*;public class DataIOTest
{
public static void main(String[] args)
{
DataOutputStream out;
double[] prices = {19.99 , 9 , 15.99 , 3.99, 4.99};
int[] units = {12, 8, 13,29,50 };
String[] descs = {"JAba" ,"java","Duke","JVAV","JAVA"};
try
{
out = new DataOutputStream(new FileOutputStream("invoicel.txt"));
for (int i = 0 ; i < prices.length ;i ++)
{
try
{
out.writeDouble(prices[i]);
out.writeChar('\t');
out.writeInt(units[i]);
out.writeChar('\t');
out.writeUTF(descs[i]);
out.writeChar('\t');

}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try
{
out.close() ;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
DataInputStream in = null;
try
{
in = new DataInputStream(new FileInputStream("invoicel.txt"));
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
double price ;
int unit ;
String desc ;
double total = 0.0 ;
for( int i = 0 ; i <prices.length; i ++)
{
try
{
price = in.readDouble();
in.readChar();
unit = in.readInt();
in.readChar();
desc = in.readUTF();
in.readChar();
System.out.println("You hava oredered " + unit + "units of " + desc + "at $" + price);
total = total + unit*price ;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

}
System.out.println("For a TOTAL of : $ " +total) ;
try
{
in.close() ;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
在终端可以看到运行的结果,但是为什么invoicel.txt中全都是乱码?怎么处理可以解决这个问题?求解java