IO 输出编码问题 为什么输出不了中文汉字。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 File file=new File("hello.txt"); byte b[]="欢迎 welcome".getBytes(); System.out.println(file.getAbsolutePath()); try { FileOutputStream out=new FileOutputStream(file); out.write(b); out.close(); FileInputStream in=new FileInputStream(file); Reader a; int n=0; while((n=in.read(b, 0, 2))!=-1) { String str=new String(b,0,2); System.out.printf("%s",str); } } catch (IOException e) { // TODO: handle exception System.out.println(e); } } 可以显示啊.d:\myjava\hello.txt欢迎 welcomed:\myjava> D:\workspaces\Tc\hello.txt����� welcome 为什么我的是这样的 我把工作空间到项目到工程到类的编码格式都改成GBK就行了。 我把工作空间到项目到工程到类的编码格式都改成GBK就行了。 上传重名问题 JScrollPane滚动刷新 JTable表单的问题?急 !急!如律令! JAVA中怎样自动生成不重复的数字(急) java怎么实现p2p 谁能将以下java代码帮我装换成c代码,要在linux下能运行,还要详细说明编译、运行步骤,不好意思,我对c不太熟悉 Exception in thread "main" java.lang.NoClassDefFoundError: hello/java 如何配置tomcat4.0.4 那里可以找到类似chm格式的java帮助文档? javac 小问题? java ITAT往届试题 发布本人做的一个java 关键字查询文档
File file=new File("hello.txt");
byte b[]="欢迎 welcome".getBytes();
System.out.println(file.getAbsolutePath());
try {
FileOutputStream out=new FileOutputStream(file);
out.write(b);
out.close();
FileInputStream in=new FileInputStream(file);
Reader a;
int n=0;
while((n=in.read(b, 0, 2))!=-1)
{
String str=new String(b,0,2);
System.out.printf("%s",str);
}
} catch (IOException e) {
// TODO: handle exception
System.out.println(e);
}
}
d:\myjava\hello.txt
欢迎 welcome
d:\myjava>
����� welcome 为什么我的是这样的