just replace the condition of the there loops with 26. Now the exception index out of bound will not occur
public class SuggestingAppNames {
public static void main(String[] args) {
System.out.println(“the possible outcomes are”);
String a = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
String d[] = a.split(",");
String b = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
String e[] = b.split(",");
String c = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
String f[] = c.split(",");
for (int i = 0; i < 26 ; i++) {
for (int j = 0; j < 26; j++) {
for (int k = 0; k < 26; k++) {
System.out.println(d[i] + e[j] + f[k]);
}
}
}
}
}
solved why is it showing error . Like I thought the third loop will end and it will enter the first loop but didn’t else showed an exception