About interfaces, about io Interfaces

Source: Internet
Author: User

About interfaces, about io Interfaces

1. What is it?

Interface, which describes Specifications, A type DescriptionOr Conventions. It cannot be understood as an abstract class. The meaning of an abstract class is how to direct and the interface tells you what to do, Ii. Naming rulesGenerally "I"Starting "Able"End. 3. Syntax 1.The interface can only have methods. That is to say, the interface cannot have the variable (field) attribute. The interface is not implemented, and the field is meaningless. 2.You can define multiple methods or do not define any methods (* identifies an interface ). 3.The interface has no constructor, because the meaning of the interface is not what the interface can implement, and the constructor has no significance. 4.Access modifiers cannot be added to interface members. 5.Methods In the interface cannot be implemented. 6.The interface cannot be instantiated. 7.Abstract classes can only be single-inherited, and interfaces are multi-inherited. Si. Purpose 1.For multi-Inheritance 2.When multiple classes have a common method, but they cannot abstract a parent class. You can use interfaces. (This is a bit difficult, For example: "The plane can fly, the birds can fly, and I can fly when I drink too much. Can these things abstract a parent class ?")

 

Related Article

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.