public static void main(String args)
char arr=new char;
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
help me guys.
1) Walk through your code on paper as if you yourself were the computer and see what the array indices are as you loop through your program, then you'll immediately see your error.
2) An unrelated problem, but one that will effect your output in the second loop (after you fix its array index out of range problem: Always enclose any for loop, while loop, if block, etc... in curly braces. If you don't, you will shoot yourself in the foot (like this program will do).
Best of luck.
Put the for loops in try block followed by catch statement for (ArryIndexOutOfBounds e)
write to me if still problem persists
:: Java Needs - Java Programmers' Website ::
Hm, I politely disagree with using a try / catch block here as this is an exception that shouldn't ever happen. It's like using try / catch for a NPE.
Again if you think through the logic, you should find the solution. What is the ultimate goal of this program, by the way?