OCPJP
When you define a new interface, you are defining a new reference data type. You can use interface names anywhere you can use any other data type name. If you define a reference variable whose type is an interface, any object you assign to it must be an instance of a class that implements the interface.
Campbell Ritchie wrote:You can create an instance of an interface as an anonymous class, but that is rather different.
Junilu Lacar wrote:Although now that I think about it, the statement "You can't create objects from an interface" is technically correct. See InstantiationException. You can create objects using just an interface to define an anonymous class but instances are still created from the anonymous class, not from the interface. Again, it's just a matter of semantics and how anal you want to be about the subtleties.
The biggest gamble will be to ask a question whose answer you know in that it will challenge your theory | www.TechAspire.blogspot.in