The difference between an interface and an abstract class

Source: Internet
Author: User

Interface ABSTARCT class

1, a class in Java can implement multiple interfaces

2, "lika A relationship, There is no relationship;

method is public static abstract ,

    cannot have the that is, the method body, can only be declared;

4, interface is abstract for behavior;

public static final ;

1, a class in Java can only inherit an abstract class ;

2, is said to bea"is a" relationship, is not the relationship;

3, the method in the abstract class can have implementation and declaration ;

4, abstract class is the abstraction of things , that is, the abstraction of the class;

5, the variables in the abstract class can be a variety of types ;

1, can not be instantiated ;

2, Java in two forms to embody the abstract of OOP : interface and abstract class;

The difference between an interface and an abstract class

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.