Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java try catch

try {
  // Code to try, which is throwing an Exception, e.g.
  /*example*/ Thread.sleep(100)
} catch (InterruptedException e /*Or any other exception*/) {
  // Handle Exception, usually:
  e.printStackTrace(); // Print the StackTrace of the exception to see what cause it
} finally {
  // Code executed after try / catch, used to close streams
  /*example*/ in.close();
}
 
PREVIOUS NEXT
Tagged: #java #catch
ADD COMMENT
Topic
Name
9+1 =