This is the code that I\'ve written.
int num; try { num=100; DoSomething(); System.out.println(num); } catch(Exception e) { DoSomething1(); }
Local variables in Java are not initialized automatically. So you need to initialize it before use them.
int num=0; try { .. } ...
Fore more info read - Definite Assignment (JLS - 16.2.15 try Statements)