Friday 15 February 2013

java - Should you catch all exceptions in your main method -


Is it all right to capture everything in the main? If not, then why?

  public static zero main (string [] args) {try // // hold too many // calls} (exception e) {e.printStackTrace (); }}    

Generally it is better to separate the capture IMO, so that you can handle it Even if each is different, even if you end up dealing with one, it is also easy to see what the risk is, hold , when you return to your code Are there. Just a quick example:

  hold {} (URI syntax expression) {e.printStackTrace (); } Hold (IOException e) {request.abort (); } Finally {client.close (); }    

No comments:

Post a Comment