Neebal Technologies interview question

A Java interface has to implemented, but not all of its method are required. How do you implement the interface without even bothering about the methods you dont require? In other words, methods you dont require must not be overridden by your class.

Interview Answer

Anonymous

1 Jun 2012

I answered - Make a permanent wrapper class that implements that interface and also overrides ALL the methods, with empty braces for unnecessary methods. Then use that class as a parent class for other concrete classes, in which only required methods will be overridden.

5