Java Learning (ix)

Source: Internet
Author: User
Interface

An interface is a special kind of abstract class. All methods in an interface are abstract, and all methods do not provide a concrete implementation, because the interface is all abstract and cannot be instantiated, only the method can be implemented. A class cannot inherit an interface, only a method that implements an interface definition. If a class implements an interface, it must define all methods, unless he is an abstract class
An interface can be understood as a capability, and whoever implements it will gain this ability to define variables in the interface, but must bepublic static final 数据类型 名字

Interfaces are not classes, and interfaces contain only the behavior that a class needs to implement

The use of interfaces

Interfaces can be used to expose certain behaviors of a class, not all behaviors. Interfaces can also be used to enforce behavior on other objects to ensure that some methods are implemented by the object

Interface declarationpublic interface 接口名{任意数量的final static成员变量和任意数量的方法}

Interface Implementation public class 类名 extends 父类名 implements 接口名 A class can implement multiple interfaces, and the interface uses commas "," to separate

Inheritance and Interfaces

Inheritance is an abstraction of an object----interface is an abstraction of the behavior

Debugging

function Key -F5: One-step debugging, if a method is called to jump into the method-F6: Step debugging, but does not jump into the method-F7: Jump out of the method currently being debugged-F8: not single-step debugging, jump directly to the next hit a breakpoint position

Java Learning (ix)

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.