我想写出我的数组的值到一个文件。写入磁盘文件不正确
public void Write(String fileName) throws IOException
{
PrintWriter outFile;
outFile = new PrintWriter(new FileWriter(fileName));
for(int K = 0 ; K < CurrentCount ; K++)
outFile.println(List[K].toString());
outFile.close();
}
的数据输入到文件是:气象站@ 1194a4e
的气象站类有我的构造函数和get和set方法
List[K] = new WeatherStation(Location, Temp, Title, Air, Pollen);
我期待所有的属性上面来获得放入文件中。
...他们呢? – fredley 2011-03-11 00:55:50
[How to support println in a class?](http://stackoverflow.com/questions/27647567/how-to-support-println-in-a-class) – Raedwald 2016-03-26 14:09:39
http:// stackoverflow的可能重复.COM /问题/ 29140402 /如何-DO-I-打印我的Java对象,而无需-得到-sometype2f92e0f4 – Raedwald 2016-03-26 14:19:45