- Apache Spark 2.x for Java Developers
- Sourav Gulati Sumit Kumar
- 121字
- 2021-07-02 19:01:55
Interfaces
Interfaces are the reference types in Java. They are used in Java to define contracts among classes. Any class that implements that interface has to adhere to the contract that the interface defines.
For example, we have an interface car as follows that consists of three abstract methods:
public interface Car { void shape(); void price(); void color(); }
Any class that implements this interface has to implement all the abstract methods of this interface unless it is an abstract class. Interfaces can only be implemented or extended by other interfaces, they cannot be instantiated.
Prior to Java 8, interfaces consisted only of abstract methods and final variables. In Java 8, interfaces may contain default and static methods as well.
推薦閱讀
- Learning NServiceBus(Second Edition)
- QGIS:Becoming a GIS Power User
- Drupal 8 Configuration Management
- LabVIEW虛擬儀器入門與測(cè)控應(yīng)用100例
- Java 9 with JShell
- SEO教程:搜索引擎優(yōu)化入門與進(jìn)階(第3版)
- 百萬(wàn)在線:大型游戲服務(wù)端開發(fā)
- 啊哈C語(yǔ)言?。哼壿嫷奶魬?zhàn)(修訂版)
- Visual C++程序設(shè)計(jì)全程指南
- PHP 7 Programming Blueprints
- Swift Essentials(Second Edition)
- Raspberry Pi開發(fā)實(shí)戰(zhàn)
- Visual C++程序開發(fā)范例寶典
- Kotlin核心編程
- Learning RxJava