0

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 );
    }
}

Edited by hashim5003

2
Contributors
1
Reply
6
Views
5 Years
Discussion Span
Last Post by stultuske
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.