在继承中的异常
在继承中的异常
2011年09月01日
public interface ExceptionInterface { void exceptionedMethod()throws Exception; } public abstract class ExceptionAbstractClass implements ExceptionInterface{ public void exceptionedMethod() throws/* Exception,*/UnsupportedOperationException { } } public class ExceptionClass extends ExceptionAbstractClass { public void exceptionedMethod() throws Exception { } }
最后一个会报错。
PS:UnsupportedOperationException : /** * Thrown to indicate that the requested operation is not supported. * * This class is a member of the * * Java Collections Framework. * * @author Josh Bloch * @version 1.15, 01/23/03 * @since 1.2 */