// This program reads a file and puts < > marks around // any uppercased tokens it finds. import java.io.*; // for File import java.util.*; // for Scanner public class WebPage { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("webpage.txt")); while (input.hasNextLine()) { String line = input.nextLine(); // "TITLE My web page /TITLE" Scanner lineScan = new Scanner(line); while (lineScan.hasNext()) { String token = lineScan.next(); // "TITLE", "My", "web" String cap = token.toUpperCase(); if (token.equals(cap)) { System.out.print("<" + token + "> "); } else { System.out.print(token + " "); } } System.out.println(); // insert a line break to match the original file } } }