I'm sorry, I meant causing an exception here is the code and the exception.
public static void charCount(
String just){
String currentChar = "";
String upper = just.toUpperCase();
String nextChar = "";
int count = 1;
System.out.println(upper);
for (int k = 0; k < (upper.length()); k ++) {
//System.out.println(upper.length());
currentChar = "" + upper.charAt(k);
System.out.println(currentChar);
System.out.println(k);
for (int j = 0; j <(upper.length()); j ++) {
nextChar = "" + upper.charAt(j + 1);
//System.out.print(j);
if (currentChar.equals(nextChar)){
count++;
}
else
continue;
}
System.out.print(count);
count = 0;
}
}//charCount
the exception is:
Exception in
thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 31
at java.lang.String.charAt(String.java:516)
at A2Q3.charCount(A2Q3.java:94)
at A2Q3.getInformation(A2Q3.java:59)
at A2Q3.main(A2Q3.java:113)