What do the try and the catch commands in Java do?
1
Expert's answer
2011-06-09T07:48:54-0400
try catch commands makes possible to process exceptions. Syntax: try { //your code that may cause exception } catch(Exception e) //here can be another call of exception { //code that process exceptions } final //you can loose this block. Just do not write it. It is not error { //code that will be executed any case } See documentation to get to know about list exception classes. example: try { a=b/c; } catch(Exception e) { System.out.println("Division by zero occured"); }
Comments
Leave a comment