9.5 Overview

  1. Java can create an abstract class, designed to as a parent. The role of the abstract class corresponds to the "template", the purpose is to modify and create new classes based on their format.
  2. The method of abstract class can be divided into two types: one is the ordinary method; the other is the "abstract methods" abstract beginning keywords, and abstract method does not define method body, but you want to keep to derive from the abstract class The new class to override mandatory.
  3. An abstract class can not be directly instantiated keyword new, must instantiate operation upwardly through transition polymorphism subclass object using object.
  4. The interface is a collection of methods and global constants, subclass must implement the interface, an interface can inherit multiple interfaces simultaneously extends, a subclass can implement multiple interfaces implements keyword.
  5. After jdk1.8 version of the interface provides a common approach has allowed the definition of default and static methods static definition.
  6. Java does not allow multiple inheritance and class, but allows multiple interfaces, only to realize the concept of multiple inheritance with interfaces.
  7. Interface with the general class, can be derived by extending new interface technology. The original interface or interface is called a basic parent interface; interfaces derive the derived interface or sub-interface is called. Through this mechanism, derived interface not only can keep the members of the parent interface, but can also add new members to meet actual needs.
  8. ClassCastException problem can be avoided using the generic Object receives parameters brings.
  9. Generic Object making references must use a wildcard when receiving type "?."
Published 162 original articles · won praise 9 · views 3105

Guess you like

Origin blog.csdn.net/ll_j_21/article/details/104589303