I have two string
String s1 = "";
String s2 = "";
Boolean check = s1 != null && s2 != null && s1.substring(1) != null;
then return check;
Why this code is throwing StringIndexOutOfBoundException? If s1 ="" then why it is checking for s1.substring(1) != null when s1 != null is false ? It should return false not throw Exception? How to resolve this?