I want to get position of "," so i have used charAt function
below is the code
public class JavaClass {
public static void main(String args[]){
System.out.println("Test,Test".charAt(','));
}
}
but the problem is i am getting StringIndexOutOfBoundException can any body help me why i am getting this error
also i want to know that if ',' is not found than what the value will be return
error is below
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 44
at java.lang.String.charAt(Unknown Source)
at JavaClass.main(JavaClass.java:5)
charAtjavadoc and read about primitive types.','is considered anintin that method call.String index out of range: 44should've given that away.