TryCatch jump to the catch

bla!= should be followed by a condition, throws should be throw, Exception() should be new Exception(), exception should be Exception e

try {
 if (bla != null) // or anything else
  throw new Exception("Exception thrown");
} catch (Exception e) {
 System.out.println("Exception caught!");
 e.printStackTrace();
} 

Leave a Comment