Complementarity of java--interface--Implementation of interface

Source: Internet
Author: User
Tags constant definition

1. Classes that are more abstract than abstract classes are interfaces, interfaces (interface)
2. There are only two things in the interface: constants and exposed abstractions, void Tes () equivalent to public abstract void tes () public void Test ().
3. When the interface constant is defined, the constants that are written or not written are preceded by public static final, which is: int max_speed = 120; equivalent to public static final int max_speed = 120;
4. The meaning of the interface also lies in the separation of design and implementation, and interfaces abstract the common denominator of many classes.
5. Why do I need an interface? What is the difference between an interface and an abstract class? The
* interface is an abstract class that is more abstract than the abstract class, and can be constrained by a more canonical subclass. A comprehensive and professional realization: the separation of specifications and concrete implementation. The
* Interface is a specification, defined by a set of rules that embody the real world "if you are ... You must be able to ... "thought. For example: If you are an angel, you must be able to fly, if you are bad, you must bully good people. The nature of the
* interface is a contract, just like the law of our people. After the establishment of the people abide by.
* The specific requirements of the project are changeable, we must status quo to develop, the "unchanged" here is the "specification". So our development projects are interface-oriented programming.
6. Define interface:
Format:
     [access modifier] Interface interface Name [extends parent interface 1, parent interface 2]{


      & nbsp   Constant definition  //always  public static final
          method definition  //always  public Abstra CT


}
7. Subclasses implement specifications in interfaces by implements
8. Interfaces cannot create instances, but can be used to reference variable types.
9. A class implements an interface and must implement all the methods in the interface, and these methods can only be public.
10. The interface supports multiple inheritance.
11. Describing a more abstract relationship can only use interfaces. Because if you use inheritance only single inheritance cannot achieve a more abstract relationship.

java--Interface Supplement--implementation of the interface

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.