I instantiated an object of an anonymous class to which I added a new method.
Date date = new Date() { public void someMethod() {} }
I
No, that is what method-local classes are for.
class MyDate extends Date() { public void someMethod() {...} } MyDate date = new MyDate(); date.someMethod();