Home  >  Article  >  Java  >  What are the characteristics of the interface?

What are the characteristics of the interface?

王林
王林Original
2020-06-28 16:19:2813397browse

The characteristics of the interface are: 1. The interface is modified with the interface keyword; 2. The interface cannot be instantiated; 3. The implementation class must implement all methods of the interface (except abstract classes); 4. The implementation class can Implement multiple interfaces; 5. The constants in the interface are all static constants

What are the characteristics of the interface?

java interface features:

(recommended tutorial: Java entry program)

(1) The interface is modified with the interface keyword;

(2)The interface cannot be instantiated;

(3)The implementation class must All methods that implement interfaces (except abstract classes);

(4) Implementation classes can implement multiple interfaces (java multiple inheritance);

(5) Constants in interfaces are static constants ;

(Video tutorial recommendation: java video tutorial)

Code sample:

public  interface Myinter{
 
    public abstract void foo();
     
   //其他方法
 
}

The above is the detailed content of What are the characteristics of the interface?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn