class MyException extends Exception{}
interface Bread
{
public void eat() throws MyException;
}
interface Fringe
{
public void eat() throws RuntimeException;
}
public class Test implements Fringe , Bread // #5
{
public static void main(String[] args)
{
Fringe best = new Test(); // #1
best.eat();// #2
}
public void eat() throws RuntimeException // #3
{
System.out.println("Test");
throw new RuntimeException(); // #4
}
}
MyException
がRuntimeException
ありません。 Test.eat()
をRuntimeException
と投げると宣言できますが、一般的なものはException
ではありません。
これはコードレントコードですか? MyExceptionは実際にはどこにでもスローされません。 – cha0site