Hi Kannan,
the try catch block works perfectly if i use a IF condition
You are getting Nullpointer Exception here, because you are trying to invoke the method (equalsIgnorecase()) on a null object.Whenever you try to manipulate a object which is null then Null pointer exception is thrown
if(abc.equalsIgnorecase("null"))
If you want to compare whether the String object returned by Diffclass.getString() method is null or not then you must code it like this:
if(abc==null)
else the try catch block is never reached
When you comment if condition in your code, then you are not manipulating the returned String object, so an exception is not thrown when that returned string object is null.
Regards,
Sujith