Java/Default keyword: Difference between revisions
From charlesreid1
(Created page with "Default keyword: {{Quote| It's a new feature in Java 8 which allows an interface to provide an implementation. Described in Java 8 JLS-13.5.6. Interface Method Declarations w...") |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Default keyword | Default keyword helps to make [[Java/Interfaces]] work a little bit more like [[Java/Abstract Class]]es. | ||
{{Quote| | {{Quote| | ||
It's a new feature in Java 8 which allows an interface to provide an implementation. Described in Java 8 JLS-13.5.6. Interface Method Declarations which reads (in part) | It's a new feature in Java 8 which allows an interface to provide an implementation. Described in Java 8 JLS-13.5.6. Interface Method Declarations which reads (in part) | ||
"Adding a default method, or changing a method from abstract to default, does not break compatibility with pre-existing binaries | "Adding a default method, or changing a method from abstract to default, does not break compatibility with pre-existing binaries..." | ||
"Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces." | "Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces." | ||
| Line 12: | Line 10: | ||
- [https://stackoverflow.com/questions/31578427/what-is-the-purpose-of-the-default-keyword-in-java#31578471 source] | - [https://stackoverflow.com/questions/31578427/what-is-the-purpose-of-the-default-keyword-in-java#31578471 source] | ||
}} | }} | ||
[[Category:Java]] | |||
[[Category:Interfaces]] | |||
[[Category:Inheritance]] | |||
{{CSFlag}} | |||
Latest revision as of 22:22, 15 August 2017
Default keyword helps to make Java/Interfaces work a little bit more like Java/Abstract Classes.
It's a new feature in Java 8 which allows an interface to provide an implementation. Described in Java 8 JLS-13.5.6. Interface Method Declarations which reads (in part)"Adding a default method, or changing a method from abstract to default, does not break compatibility with pre-existing binaries..."
"Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces."
- source
| Computer Science notes on computer science topics on the wiki, for educational and learning purposes
Part of the 2017 CS Study Plan.
Python/Exceptions · Python/Assertions · Python/Decorators Python/Os (os module) · Python/Strings Python/Splat · Python/Iterators · Python/Generators Python/Comparators · Python/Lambdas
Builtin features of Java: Java/Exceptions · Java/Assertions · Java/Memory · Java/Interfaces Java/Generics · Java/Decorators · Java/Diamond Notation Java/Iterators · Java/Iterable · Iterators vs Iterable Java/Comparators · Java/Comparable · Comparators vs Comparable Java/Numeric · Java/TypeChecking · Java/Testing · Java/Timing · Java/Profiling Documentation: Javadocs · Java/Documentation Tools and functionality: Java/URLs · Java/CSV External libraries: Guava · Fastutil · Eclipse Collections OOP: OOP Checklist · Java/Abstract Class · Java/Encapsulation · Java/Generics
|
See also: