o What is meant by an anonymous class and how is it useful i
Solution
1) A class that has no name and contained inside a class is called an anonymous class.
Usage of Anonymous class
a) Since an anonymous class is an inner class contained in a class we can use the methods and objects inside it by taking the object of the class in which it was contained.
b) We can also overload methods and we need not have any declaration for subclass.
c) The code will be very clear.
d) It will be quick for execution
e) They are normally used in Adapter Class
2) Diamond Problem.
Let us take base class as A,
Two more interfaces are derived B and C.
One more class is derived D from B and C.
As in interface the methods are not defined we have to define them in derived class that actually implements that interface and hence there will be no ambiguity like which method has to be used from sub classes B and C
