代码有误
这是我重新写过的
class MyException extends Exception{
  static int InstanceNumber=0;
 
  MyException(String message){super(message)}
  void run(int j) throws MyException{
        if (j%2!=0){
          InstanceNumber++;
          throw new MyException();
          
          }
        }
    
  String Say(){
return "I'm MyException."+InstanceNumber+"!";
  }
}
public class UseMyException{
   public static void main (String[] args){
int i;

MyException My=new MyException();
System.out.println ("test my exception");

for (i=0;i<7;i++){
try{
   My.run(i);
}catch(MyException e){
   System.out.println("A exception\n"+My.Say());
}
System.out.println("test end.");
}
   }
}