Monday, 13 February 2017

UnCheckedException : NumberFormatExcept




public class NumberFormatExcept {

    public static void main(String[] args)
    {
        String str="N/A";        try {
            int val=Integer.parseInt(str);        }catch (NumberFormatException e){
            System.out.println("not a number");            e.printStackTrace();        }
    }
}

No comments:

Post a Comment