help me through this program
publicclass Reverse{
int count;
publicvoid forward(char inp[] ){
for (count=0 ;inp[count] !='\0'; count++){//error
System.out.print(inp[count]);
}
System.out.print(" | ");
}
publicvoid backward(char inp[]){
while(count != 0){
System.out.print(inp [count]);
count--;
}
}
}
publicclass MainMethod{
publicstaticvoid main(String args[]){
char[] input ={'s','a','u','r','a','b','h'};
Reverse call =new Reverse();
call.forward(input);
call.backward(input);
}
}
i am getting an error. i am not getting through the solution
__
ERROR:
run:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
at Reverse.forward(Reverse.java:6)
at MainMethod.main(MainMethod.java:5)
__
there is some problem in the 'for' loop.
help me

