Where am I wrong in this program? without print function with void in reverse functio it works fine.

public class Question1 {

    public static void main( String [] args ) {
        // TODO Auto-generated method stub

        char [] myName = { 'H', 'A', 'S', 'H', 'I', 'M' };

        char temp = reverse ( myName );
        print ( temp );

    }


    public static char reverse ( char [] array ) {

        for ( int i = 5; i >= 0; i-- ) {
            char reverseArray = array [i];
        }   
        return reverse;

    }

    public static void print ( char array ) {

        System.out.println ( array );
    }
}

that would depend on what it is you are trying to accomplish (get as output).
can you elaborate more on that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.