标题: 关于异常的代码问题? [打印本页] 作者: 鲍霄霄 时间: 2012-7-18 08:31 标题: 关于异常的代码问题? package com.java.bxx;
import com.sun.org.apache.xerces.internal.util.*;
public class ExceptionEffectOnInheritance extends Light{
/*
public void light() throws IOEception{
System.out.println();
}
public void getEnergy() throws IOEception{
} */
public static void main(String[] args)
{
Light light =new ExceptionEffectOnInheritance();
try{
light.getEnergy();
light.light();
}catch(Exception e){
e.printStackTrace();
}
}
}
class Light{
private int energy;
public void light() throws MalformedURIException{
System.out.println("等待发光中");
}
public int getEnergy() throws Exceeption{
return energy;
}
}
上述的代码都是什么异常;还有在我把ExceptionEffectOnInheritance中的同名方法注释取消以后系统提示出了Exception IOException is not compatible with throws clause in Light.light()之类的错误信息又是什么原因?作者: 温少邦 时间: 2012-7-18 08:54
1.MalformedURIException,IOException没有导入