Keywords of the method cannot be modified together with abstruct, which is the abstruct keyword.

Source: Internet
Author: User

Keywords of the method cannot be modified together with abstruct, which is the abstruct keyword.

Abstract class: at least one dynamic method is an abstract method.

Which of the following keywords cannot be modified together with the abstruct keyword modifier?

1 private

Because the private modifier is hidden and invisible in the subclass. The abstruct modifier method is abstract and needs to implement the method body in the subclass. Therefore, they conflict with each other and cannot be used together.

 

2 static

Static indicates that this method is a class method, and there is only one copy in the memory, while abstruct indicates a dynamic method and is bound to the object. So there is a conflict and it is not feasible.

 

3 final

The final method indicates an immutable method, that is, a method that cannot be modified in the subclass. It is inconsistent with the implementation in the subclass represented by abstruct, so the same method cannot be modified together.

 

Knowledge points in Interfaces

Interface function:

1 program decoupling

2. Define Constraints

3. Extended Functions

 

Attention details

1. variables defined in the interface. The default modifier is public, final, and abstruct.

2. The default modifier is public and abstruct.

3. The interface cannot create objects.

4. No constructor IN THE INTERFACE

5. All methods in the interface should be implemented when non-abstract classes are implemented.

 

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.