public doSomthing() throws Exception {...}public static void main(String[] args) {try {
   doSomthing();
}
catch(Exception e)
    System.out.println("doSomthing error occured");
}