Hi, i am trying to create a method that will accept a string, it will then return a string with every pair of words in the first string reversed.
For example, input string: " Hello this is a test string to reverse every pair of words "
output string: " this Hello a is string test reverse to pair every words of"
so far i have below but i am stuck and really need help. I really appreciate it. Thanks
// public static String wordPairReverse(String source){ StringTokenizer st = new StringTokenizer(source, " "); String strReversedLine = ""; char j=0; while(st.hasMoreTokens()){ while(j<2){ strReversedLine=st.nextToken()+" "+strReversedLine; j++; ... } //