Jen abstract class and abstract method of Java basic notes for babies

Source: Internet
Author: User

First, exhausting and abstract methods
1. Abstract methods in abstract classes must be implemented by the quilt class unless the subclass is also abstract.
2. Abstract class cannot be instantiated but abstract class references can aspire to a concrete implementation of his sub-class object
3, the abstract class has the construction method can not be called by the way of the instantiation, but may be called when the subclass object is created, so the abstract tired construction method is to let the child class call
4. Abstract methods in abstract classes cannot be called because an object cannot have an abstract class (abstract classes cannot be instantiated)
5, abstract class can have ordinary members (variable method) static method But the subclass of the same name of the static method does not constitute a rewrite to pay (override implementation)


Second, the interface
Public interface Interface Name {
Static constants (public static final)
Abstract method (Pubilc abstraction)

An interface is a class row that is more abstract than an abstract class
Interface is the constraint to its implementation class, which constrains the design of the implementation class to provide a specification

If a subclass inherits an abstract class colleague implements an interface that can only use subclass references to simultaneously invoke the implementation of the parent class interface
A class can implement multiple interfaces multiple interfaces can use a comma interval

Jen abstract class and abstract method of Java basic notes for babies

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.