java.io FileOutPutStream-字符之间有空格.为什么? [英] java.io FileOutPutStream - There are white spaces among chars. Why?
本文介绍了java.io FileOutPutStream-字符之间有空格.为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用这段代码写一些东西,但是我运行后在字符之间有空格.但在代码中,我不给字符串空格.
i want to write something with this code but after i run there are white spaces between characters. but in code i dont give space to string.
import java.io.*;
public class WriteText{
public static void main(String[] args) {
FileOutputStream fos;
DataOutputStream dos;
try {
File file= new File("C:\\JavaWorks\\gui\\bin\\hakki\\out.txt");
fos = new FileOutputStream(file);
dos=new DataOutputStream(fos);
dos.writeChars("Hello World!");
}
catch (IOException e) {
e.printStackTrace();
}
}
}
输出为(在文本文件中):H e l l o W o r l d !
Output is (in text file) : H e l l o W o r l d !
推荐答案
查看全文