/** * @author Leah Zagreus * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ import java.util.*; import java.io.*; public class EchoFileToken { public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new FileReader("myFile.txt")); String inputLine = br.readLine(); String outputLine = new String(""); StringTokenizer st = new StringTokenizer(inputLine); while (st.hasMoreTokens()) { String token = st.nextToken(); outputLine = outputLine.concat(token); } System.out.println(outputLine); } catch (FileNotFoundException fileerror) { } catch (IOException ioerror) { } } }