当前位置: 代码迷 >> Java相关 >> [求助]why?
  详细解决方案

[求助]why?

热度:242   发布时间:2006-10-25 17:38:42.0
[求助]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  

----------------解决方案--------------------------------------------------------
unreported exception java.io.UnsupportedEncodingException; must be caught or declared to be thrown
有异常,你要么声明抛出,要么就用try把它抓起来
----------------解决方案--------------------------------------------------------
你得抛出这个异常UnsupportedEncodingException    或者用"US-ASCII"编码  
----------------解决方案--------------------------------------------------------
  相关解决方案