Scanner/StringBuffer classes

import java.io.*;
import java.util.*;

public class ScannerPhraseIn
{
  public static void main (String[] args) throws IOException
  {  
       
    String word, newWord="";

    BufferedReader objReader = new BufferedReader (new InputStreamReader (System.in));
    StringBuffer newPhrase = new StringBuffer ("");// empty object
    
    System.out.print ("Please enter a line: ");
    String line = objReader.readLine (); 
    
    Scanner scannerObj = new Scanner(line); 
    
    while (scannerObj.hasNext())
    {
      word = scannerObj.next(); 
      newWord = word.concat("doh");// manipulate string
      
      newPhrase.append(newWord);// fill StringBuffer with new manipulated tokens
      newPhrase.append(' '); // add a space
      
    } 
    
     String output = newPhrase.toString();// convert back to a string
     System.out.println(output);
  }
} 


.............................................................................................................

To access Pig Latin Rules here...