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