不是函数的我知道
但是有了函数怎么确定参数呢
import java.io.*;
class MyException extends Exception
{
MyException()
{
super();
}
MyException(String s)
{
super(s);
System.out.println("the Exception with ABCD");
}
}
public class exception
{
public static void main(String args[])throws IOException
{
while(true)
{
try
{
fn();
}
catch(IOException e)//怎么做转型啊 ,instanceof不行,这样没法接受啊
{
System.out.println("please again");
}
catch(MyException m)
{
break;
}
}
}
static void fn()throws Exception //throws Exception感觉很象函数异常时的返回
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("putinto u String");
String temp=br.readLine();
if(temp.equals("ABCD")==false)
{
throw new IOException();
}
else if(temp.equals("ABCD"))
{
throw new IOException("ABCD");
}
}
}