Java examples for Object Oriented Design:Exception
Throwing Your Own Exceptions
public class MyException{ public static void main(String[] args){ try{/*from w w w . j a va 2s . c o m*/ doSomething(true); }catch (Exception e){ System.out.println("Exception!"); } } public static void doSomething(boolean t) throws Exception { if (t) throw new Exception(); } }