public class StringDemo{
public static void main(String[] args) {
String str = "this:";
int a = str.indexOf(":"); // returns 4
String subStr = str.substring(a+1); // returns "" <empty string>
String subStr = str.substring(a+2); // throws exception
int charAt = str.charAt(a+1); // Throws an StringIndexOutOfBoundsExp.
}
}
can any one explain why is it returning "" and why it throws an exception