Friday, April 12, 2019

exception handling

public class cl {
 public static void main(String args[]) {
  String s=null;
System.out.println(s.length());//NullPointerException
  System.out.println("End Of Main");
 }
}


$javac cl.java
$java -Xmx128M -Xms16M cl
Exception in thread "main" java.lang.NullPointerException
 at cl.main(cl.java:4)

No comments:

Post a Comment