How can i jump to the catch block in a try catch :
try{ if(bla!=) throws Exception(); }catch(exception){ //do }
doesn't work ?
See Question&Answers more detail:osHow can i jump to the catch block in a try catch :
try{ if(bla!=) throws Exception(); }catch(exception){ //do }
doesn't work ?
See Question&Answers more detail:osbla!=
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();
}