Java Section 37th Interface overview

Source: Internet
Author: User
Tags modifiers

2016-06-29

1 Interface Overview

Modifiers for abstract class abstractions
Modifiers for the interface interface

Extends can only be a
Implements can be multiple

Interface only abstract method, it is more abstract than abstract class, interface is a thorough abstraction of the bottom!
An interface is a collection of properties of abstract methods and constants.
An interface can contain only abstract methods and constants, and cannot change variables, initialize blocks, or constructors.

Precautions:
1, there are only two modifiers to the interface: default and Public
2, the variables within the interface are set to common, static, and final fields.
3, there are only a collection of properties for abstract methods and constants within an interface.
int i=1;
public static final int i=1;

 Package day37; /** * Interface * 1. The modifier for the interface is only 2: Default and Public * 2. The variables within the interface are set to common, static, and final fields. * 3. There is only a collection of abstract methods and constant properties within the interface. *  @author*/Publicinterface  Test        {int I=1; // used for public static final i=1; }

Resources

[1] Java Easy Start Classic tutorial "full version"

Java Section 37th Interface overview

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.