The program before the stars was my program and my prof gave this template and i wrote in normal static user input from the program not interatively at runtime when program starts i want to give the input and get the output and i am breaking my head i need to use args
String a = " Rohit Khariwal Mohit Parnami"; Stack stack = new Stack();
// this statement will break the string into the words which are separated by space. StringTokenizer tempStringTokenizer = new StringTokenizer(a);
// push all the words to the stack one by one while (tempStringTokenizer.hasMoreTokens()) { stack.push(tempStringTokenizer.nextElement()); }
System.out.println("\nOriginal string: " + a);
System.out.print("Reverse string: ");
// pop the words from the stack while(!stack.empty()) { System.out.print(stack.pop()); System.out.print(" "); }
System.out.println("\n"); }
public static void main(String[] args) { doStringReverseWord(); }
}
********************************************* i want to do somethig like this template ********************************************* public class Reverser { public static String reverse(char[] original) { // Implement this method. }