FileDocCategorySizeDatePackage
InnerClass2.javaAPI DocExample482Sat Nov 25 12:55:42 GMT 2000None

InnerClass2.java

import java.util.Date;

/** Demonstrate simple inner class which just extends an
 * existing class (Date) by overriding one method in it.
 */
public class InnerClass2 {

	void doWork() {
		Date d = new Date() {
			public String toString() {
				return "Today is " + super.toString();
			}
		};
		System.out.println("My Date: " + d);
		System.out.println("Std Date: " + new Date());
	}

	public static void main(String[] av) {
		InnerClass2 p = new InnerClass2();
		p.doWork();
	}
}