标题:[求助]why?
只看楼主
kingyor
Rank: 1
等 级:新手上路
帖 子:66
专家分:0
注 册:2006-6-4
 问题点数:0 回复次数:2 
[求助]why?
import java.io.*;
import java.lang.String;
public class charApplication{
public static void main(String[] args)
{
OutputStreamWriter osw = null;
try{
osw = new OutputStreamWriter(new FileOutputStream("D:/test.txt"),"Unicode");//这里<-----
}
catch (FileNotFoundException ex){
System.out.println(ex);
}
try{
osw.write("\u00A9\u00BD\u0391\u0392\u0393\u0394\u00f8");
osw.flush();
}
catch(IOException ex){
System.out.println(ex);
}
}
}

我编译时出现
charApplication.java:8: unreported exception java.io.UnsupportedEncodingException; must be caught or declared to be thrown
osw = new OutputStreamWriter(new FileOutputStream("D:/test.txt"),"Unicode");
什么意思啊?
搜索更多相关主题的帖子: why 
2006-10-25 17:38
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
得分:0 
unreported exception java.io.UnsupportedEncodingException; must be caught or declared to be thrown
有异常,你要么声明抛出,要么就用try把它抓起来

可惜不是你,陪我到最后
2006-10-25 20:00
haili
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-10-23
得分:0 
你得抛出这个异常UnsupportedEncodingException    或者用"US-ASCII"编码  

~ ~ ~~c++,java,jsp,vb,要学的还有很多啊...
2006-10-26 14:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-98699-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.318393 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved