Friday, April 12, 2019

exception handling

{
 public static void main(String args[]) {
  String s="abc";
int i=Integer.parseInt(s);//NumberFormatException

  System.out.println("End Of Main");
 }
}



$javac cl.java
$java -Xmx128M -Xms16M cl
Exception in thread "main" java.lang.NumberFormatException: For input string: "abc"
 at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
 at java.lang.Integer.parseInt(Integer.java:580)
 at java.lang.Integer.parseInt(Integer.java:615)
 at cl.main(cl.java:4)

No comments:

Post a Comment