Professional Documents
Culture Documents
Default Method.
Default Method.
fo eg :
interface Example{
abstract void m1()
}
In the absence of default method : there is interface limitation we wil have to see
for example , if we are going to add additional new feature in interface then all
the different implementation will have must implemented that method for sue.
But there would be possibility that some of the implementation class dont require
that features.
========================================
So, this is the reason why default method came into picture.
>>Using default method feature we can add new methods in the interface by not
forcing subclasses to implement those new methods.
>>So we can say with default method feature implementation class programmers are
free from implementing new methods.They(implementation class programmers) can
continue with old implementation and by reusing the functionality given in the
default method in the interface. In future they(implementation class programmers)
can provide implementation as per their requirement.