.toString()
System.out.println () call the default method
.equals()
equals method in object is to compare address is the same
If we need to override the equals method can refer to the String
.hashCoad()
Gets the hash value of the object
Abstract class
Keywords: abstract
format:
public abstract class 类名{}
Abstract class action:
-
2. 3. inherited polymorphism is implemented is implemented
A // B instantiated abstract class subclasses
// Invoke method of polymorphic
A A = new new B ();feature:
-
You can not create objects (instances of), only to inherit, but there Constructor
-
abstract modification method is an abstract method to (); as the end.
public abstract void method name ();
-
The method of pumping a certain abstract class
-
Abstract methods can not use private modification, nor can you use static, final modifications
-
Implement abstract methods, a white triangle appears on the right.
-
final
-
Modifying a variable, a constant, must be given an initial value, generally associated with static
public static Final data type uppercase constant names
-
Modification methods, methods for the final method can not be overridden.
-
Modified class, the class is final class can not be inherited
interface
Keywords: interface
Features:
-
All internal default methods are disclosed in the abstract method (also omitted when public abstract),
-
Before Jdk 1.8, the interface has only abstract methods
-
All variables are internal static constant / must have an initial value
Interface extends the interface extends to many, through "," split
Implement many class implements interfaces through "," split
other
-
Local variables must be assigned an initial value before you can use
-
Property Default initial value
-
Static class name identifies the block will not rewrite
-
Constructors can not be rewritten, inheritance, and a final modification
-
Static inoperable non-static
-