0% found this document useful (0 votes)
23 views

JDK 8 Features

JDK 8 introduced default and static methods in interfaces to allow interfaces to provide implementation and utility methods. Default methods allow interfaces to define implementations that classes can optionally override, avoiding breaks to existing code. Static methods enable interfaces to provide utility methods without requiring an external utility class. These features enhanced interfaces by making them more functional and easier to work with.

Uploaded by

Shubham Uke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

JDK 8 Features

JDK 8 introduced default and static methods in interfaces to allow interfaces to provide implementation and utility methods. Default methods allow interfaces to define implementations that classes can optionally override, avoiding breaks to existing code. Static methods enable interfaces to provide utility methods without requiring an external utility class. These features enhanced interfaces by making them more functional and easier to work with.

Uploaded by

Shubham Uke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

JDK 8 Features

default method & static method in Interface

default method
We can write 'default' method in interface without forcing their implemented class.
We can enhance functionality of interface without any trouble or affect of their implemented
class no need to write forcefully implemented of 'default' method of interface.
If implemented class is not satisfied with interface 'default' method implementation then
implemented class can rewrite there own implemented.
All interface of Collection framework mostly use this feature so that Lambda Expression we
can use with Collection Framework.

static method
The main purpose of this feature is to provide utility method inside in interface instead of
utility class. It is a better approach for developer.
Without learning extra class which is utility class, we can use utility method for our purpose
from interface.
Interface 'static' method we can not call implemented class object. We can call by using
interface name.
'static' method of interface can not be override in their implemented class.

You might also like