Simple Example Program
Public class Message implements Entry {
public Message(String content, int initVal) {
counter = new Integer(initVal); }
public String toString() {
return content + “ read “ + counter + “ times.”; }
public void increment() {
counter = new Integer(counter.intValue() + 1); }
This is a Hello World, which counts how many times the client program has printed “Hello, World”.
It uses 3 classes, one for the Entry in JavaSpace, one for the main HelloWorld monitor class, and one for the client HelloWorld class.