JAVA- basis (Interface --- abstract)

JAVA- basis (Interface --- abstract)

1. What is an abstract?

Abstract definition of a thing is, the only way to know it, do not know his realization process that requires subclasses to achieve.

2. abstract considerations?

An abstract class can not be the new.

Subclass must implement all abstract methods of the parent class, or sub-class will become an abstract class.

Abstract class member variables that can be inherited.

 

3. The members of the variable rules?

Inherited member variables can be modified in addition to being private.

The modified final constants can also be inherited, can not be modified.

Method body does not know the method needs to be modified abstract format name public abstract type method (parameters);

 

4. What is the interface?

Interface is a public standards, content java7, the interface can contain constants have abstract methods, java8 may additionally contain default methods, static methods, java9 may additionally contain private methods.

5. The role of the interface?

The role of the interface is the largest multi-state.

6. Notes interface?

static methods can not achieve the type of access. If you want to call, you can call directly through the interface name directly.

In addition to the interface and a default method private static method, the other method can not have a function thereof.

Interface is not the constructor.

Constant interface is a modified public static final, even if the writing is omitted, the default is also so. Interface constants must be assigned and can not be modified, otherwise an error.

Guess you like

Origin www.cnblogs.com/fan123yh/p/10974548.html