Consider the following class :
public class Main{ public static void main ( String [] args){ try{// www .j av a 2 s .co m int i = 0; i = Integer.parseInt(args[0]); } catch (NumberFormatException e){ System.out.println ("Problem in " + i ); } } }
What will happen if it is run with the following command line:
java Main one
Select 1 option
Correct Option is : C
Because 'i' is defined in try block and so it is not visible in the catch block.