| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 613 人关注过本帖
标题:[求助]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
快速回复:[求助]why?
数据加载中...
 
   



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

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