public class Stringreverser {
    public char[] reverse(String a){
        char[] arre = a.toCharArray() ;
        char[] result = {} ;
        int count = 0 ;
        for(int inarre = arre.length -1 ; inarre >= 0 ; inarre = inarre -1 ){
            result[count] = arre[inarre] ;
            count+= 1 ;
        }
        return result ;
    }
    public static void main(String argv[]){
        System.out.println(new Stringreverser().reverse("hello")) ;
    }
}
This keeps giving me an - Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 error. 
The program is supposed to take in a string and reverse and return a char array . The problem seems to be in result[count] = arre[inarre] ; . What is the problem  ?
 
     
     
    