public static void main(String[] args){
        Scanner input = new Scanner(;
        System.out.println("Welcome to the word reversing program");
        System.out.println("First you will enter a sentence and then the letters of each word will be in the reversed order");
        System.out.print("Please enter a Sentence: ");
        String original = input.nextLine();
        String reverse = wordReverse(original);
        String[] newSentence = fixOrder(reverse);
        System.out.println("Reversing the words in the sentence: " + original + ", looks like: " + newSentence );
    public static String wordReverse(String original){

        StringTokenizer string = new StringTokenizer(original);
        Stack<Character> charStack = new Stack<Character>();

        while (string.hasMoreTokens()){

        String stack = string.nextToken();

        for (int i = 0; i < stack.length(); i ++){

        charStack.push(' ');

        StringBuilder result = new StringBuilder();

        return result.toString();   
    public static String[] fixOrder(String reverse){
       String arrayList[] = {reverse};
        String[] result = arrayList;
       for (int index = arrayList.length-1; index >= 0; index--)
            result = arrayList;
       return result;
when i run the program it states: Reversing the words in the sentence: hello world, looks like: [Ljava.lang.String;@5304f889

so if a user types: I am enjoying this the output would be i ma gniyojne siht