/** * @author mh, inspired by Jaime Nino, New Orleans, LA * @version 1.0 * @date 04.04.2002 * @package informatik2.hello * @class Hello3 */ // generally, objects have a state; // different objects may have different states; // the state is internal (private), // accessible only by authorized operations (public methods) public class Hello3 { public static void main (String[] argv) { Mouth mouth = new Mouth("Hello, World!"); mouth.say(); Mouth mund = new Mouth("Hallo, Welt!"); mund.say(); } // main } // Hello3 //--------------------- cut into two files ----------------------------- class Mouth { public Mouth (String thought) { what = thought; } // Mouth public void say() { System.out.println(what); } // say private String what; } // Mouth