Java Interface overview

Source: Internet
Author: User
Interface:
is a collection of method features that can be implemented by multiple implementation classes.
Interface Main Features:
1, the member variable in the interface the hermit's is defined as a public static constant
2, the method in the interface is abstract, and must be public
3, the interface is to be implemented by the class or inherited by the interface, it can not have its own constructor
The function of the interface:
Interface is an important means to achieve loose coupling, which describes all the services that the system exposes externally. Popular understanding, the role of the interface is to use the interface of the people and provide interface
People isolated, so that the real interface between them, the implementation of the interface does not need to care who use this interface, the use of the interface does not need to care that the interface is
Who achieved it. It's like saying I'm going to buy a socket, this socket is an interface, I don't have to care about the socket is who to do, do not care about the end of the socket
Who is going to use this socket.
The meaning of the interface:
1. In Java, abstract classes and interfaces are two mechanisms that support abstract class definitions, and it is precisely because of these two mechanisms that Java is endowed with such a powerful object-oriented capability.
2. Interfaces provide a set of rules that specify the set of rules that a class that implements this interface must have. For example, in a large system, the architect defines some key interfaces for the system, allowing the developer to know which salespeople to implement.
3, can be interface-oriented programming. Improve the maintenance and extensibility of the program.
4, the interface is to realize the software loose coupling important means, it depicts the system external all services, but does not involve any concrete realization detail. This makes each layer in the system more secure and tight.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.