INTRODUCTION TO COMPUTER SCIENCE
Robert Sedgewick and Kevin Wayne


This is the syntax highlighted version of LowerCase.java.


/*************************************************************************
 *  Compilation:  javac LowerCase.java CharStdIn.java
 *  Execution:    java LowerCase < file.txt
 *
 *  Reads in text from standard input and prints them back out to
 *  standard output, replacing each uppercase letter with the corresponding
 *  lowercase letter.
 *
 *************************************************************************/

public class LowerCase { 

    public static void main(String[] args) { 
        char c;
        while(!CharStdIn.isEmpty()) {
            c = CharStdIn.readChar();
            System.out.print(Character.toLowerCase(c));
        }
    }
}


Last updated: Wed Feb 11 18:05:27 EST 2004 .
Copyright © 2004, Robert Sedgewick and Kevin Wayne.