Home > Java > JavaBase > body text

What are the characteristics of the interface?

王林
Release: 2020-06-28 16:19:28
Original
13464 people have browsed it

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();
     
   //其他方法
 
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!