HELP! * YELLOW=global GREY=local Global HTML version of Foils prepared 1 February 97

Foil 6 A Computational Class

From Jan 27 Delivered Lecture for Course CPS616 -- Java Lecture 2 -- Basic Applets and Objects CPS616 spring 1997 -- Jan 27 1997. by Nancy McCracken * See also color IMAGE
Secs 106.5
A class may also be used to have just one computational instance.
This application reads from standard input and counts number of characters which are then printed
class Count {
public static void main (String args[])
throws java.io.IOException
{ int count = 0;
  • while (System.in.read() != -1)
  • count++;
  • System.out.println("Input has " + count + " chars.");
}}


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Feb 16 1997