import java.io.*;public class Test{
public static void main(String[] args) throws Exception{
try{
IOException e = new IOException("IO Error");
throw e;
}catch(IOException e){
System.out.println(e);
}
}
}
public static void main(String[] args) throws Exception{
try{
IOException e = new IOException("IO Error");
throw e;
}catch(IOException e){
System.out.println(e);
}
}
}
public class Test{
public static void main(String[] args){
System.out.println("Hello!");
try{
abc(5);
}catch(MyException e){
System.out.println("5 : catch MyException!");
}
try
try{
abc(-1);
}catch(MyException e){
System.out.println("-1 : catch MyException!");
}
}
public static void abc(int x)throws Exception{
if(x < 0){
MyException myException = new MyException();
throw myException;
}
}
}
////////////////////////////////////////////////////////////////
//MyException.java
public class MyException extends Exception{
MyException(){
super("MyException : test!");
}
MyException(String msg){
super(msg);
}
}