System.out.print("input fetch:");
fetchstr=fetchbr.readLine();
float fet=Integer.parseInt(fetchstr);
a.fetch(fet);
}
catch(openException e1)
{
System.out.println("open an account of money can not less 1 yuan!");
}
catch(depositException e2)
{
System.out.println("deposit can not less 0 yuan!");
}
catch(fetchException e3)
{
System.out.println("fetch more than deposit");
}
finally
{
a.quit();
}
}
};
编译时提示:
---------- javac -d . ----------
depositTest.java:21: unreported exception openException; must be caught or declared to be thrown
throw new openException();
^
depositTest.java:32: unreported exception depositException; must be caught or declared to be thrown
throw new depositException();
^
depositTest.java:43: unreported exception fetchException; must be caught or declared to be thrown
throw new fetchException();
^
3 errors
Normal Termination
Output completed (2 sec consumed).