2019.11.28 knowledge summary

Object

.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:

  1. 2. 3. inherited polymorphism is implemented is implemented

     A // B instantiated abstract class subclasses 
     // Invoke method of polymorphic
     A A = new new B ();

    feature:

    1. You can not create objects (instances of), only to inherit, but there Constructor

    2. abstract modification method is an abstract method to (); as the end.

       public abstract void method name ();
    3. The method of pumping a certain abstract class

    4. Abstract methods can not use private modification, nor can you use static, final modifications

    5. Implement abstract methods, a white triangle appears on the right.

final

  1. Modifying a variable, a constant, must be given an initial value, generally associated with static

     public static Final data type uppercase constant names
  2. Modification methods, methods for the final method can not be overridden.

  3. Modified class, the class is final class can not be inherited

interface

Keywords: interface

Features:

  1. All internal default methods are disclosed in the abstract method (also omitted when public abstract),

  2. Before Jdk 1.8, the interface has only abstract methods

  3. 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

  1. Local variables must be assigned an initial value before you can use

  2. Property Default initial value

  3. Static class name identifies the block will not rewrite

  4. Constructors can not be rewritten, inheritance, and a final modification

  5. Static inoperable non-static

  6. Function name (int ... arrray) / no argument may be, int [], 1,2,3, null.

Guess you like

Origin www.cnblogs.com/-Archenemy-/p/11954978.html