java EE fourth week study summary (including mind mapping)

One thousand Feng fourth week

day16

Review the first three weeks of knowledge

day17

Three qualifier

  • abstract modifier

    • Modified class

      • Objects not new, but the statement quoted
      • Abstract class abstract methods which do not necessarily have, but there must be an abstract method abstract class
      • After subclass inherits an abstract class, it must cover all of the parent class abstract method, or subclass will become an abstract class.
    • Modification methods

      • The only way the statement, there is no way to achieve (which need to be included in the abstract class)
  • static modifier

    • Properties and methods can be modified, without creating object access, direct use of the class name. Property name / method names.
    • Static methods can not directly access non-static member
    • Static methods can not use this or super
    • Static block of code is executed when the class is loaded and executed only once
    • Static methods can be inherited and can not rewrite, no polymorphism
  • The final modifier

    • Modified class: This class can not be inherited

    • Modification method: This method can not be overridden

    • Modifying variables: This variable can not be changed (no initial value can only be assigned once)

      • Constant values ​​unchanged
      • Reference data types the same site

day18

Syntax interface

  • Is to compile java files compiled into class files, decompile the .class file is compiled into a java file.
  • Interface defined by the interface, the interface has disclosed only a static constant; only abstract methods are disclosed (before jdk1.8)
  • The default method jdk1.8 interfaces and static methods may exist

Standardized interfaces: the interface when inside the overridden method, the modifier before a certain proportion write access to the same level or higher.

Interface concept

  • Interface is a collection of functions, the same can be seen as a special kind of data type, is more abstract than the abstract class class.
  • Interface described method should have only, and no specific implementation, implementation is done by specific interface implementation class (subclass corresponding to the interface). This will define the functions and separation, optimized programming.

Statement interface

  • Interface used instead of the original class with the other steps the same as defined in the class
  • public interface interface name extends another class / interface name {// Declare public static constants // abstract method}

Implementation of the interface

  • When the class implements the interface, the interface methods in all classes to implement. Otherwise, the class must be declared as an abstract class.

Polymorphic interface: declare an interface, implementation class is instantiated his

  • A class implements an interface; implementation class -> Parent Interface;
  • A class inherits a class; subclass (base class) -> parent class (super class)

Class / interface common relationship

  • Single inheritance: the relationship between class and class, a subclass inherits a parent class
  • Multi achieved: the interface between classes, a class can implement multiple interfaces
  • Multiple inheritance: the relationship between the interface and the interface: interface inherits multiple interfaces

day19

Interface constants

  • The most commonly used in the plurality of state variable or fixed value, defined as static constants in the interface unified management, improve code readability

Enumeration (specification range)

  • They have only their own definition of how many objects;

  • Enum class can implement one or more interfaces, use enum enumeration defined default inherited java.lang.Enum class, instead of inheriting Object, and therefore can not display enumerated classes inherit other parent

  • Enumeration class constructor can use private access specifier, if access specifier is omitted constructors, use the private modifier default; if the specified mandatory access control at only specify private modifiers

  • Enumerate all instances of the class must be explicitly listed in the first line of an enumeration type, or enumeration type can never produce instances. The system will automatically add public static final modification, without the need to add their own

  • It provides an enumeration class values ​​() method by default, which can easily traverse all the enumerated value

  • grammar structure

    Week {enum
    // Examples of these objects is represented by capital letters enumeration;
    MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURADAY, SUNDAY;
    }

    enum Week{

    MONDAY(“周一”), TUESDAY(“周二”), WEDNESDAY,THURSDAY,FRIDAY,SATURADAY,SUNDAY;

    String ch;
    private Week(String ch){
    this.ch = ch;
    }
    }

Macro Interface:

  • Implementor: Who implements the interface definition of specific methods
  • User: Call implementers written method

Callback interface: the user interface, existing before the interface implementor

day20

What is the inner class

  • Internal class can be multiple instances, each instance has its own state information and other peripheral information are independent objects.
  • In single peripheral class allows a plurality of inner classes in different ways to achieve the same interface or inherit the same class.
  • Create an internal class object creation time it does not depend on the periphery of the class object.
  • Internal class provides better encapsulation, in addition to the peripheral type, other classes can access. Private inner class;

Members of the inner class of an inner class

  • It can not exist any static member variables and methods inner classes;
  • Members of the inner class is attached to the outer class, so only create an external class to be able to create an inner class.

Static inner class of an inner class

  • It is not required depends on the creation of the enclosing class.
  • It can not use any non-static member variables and methods of the enclosing class.

The partial inner class inner class

  • There is a inner class that is nested in the method and role in, for the use of this class is the main application and more complex problem to solve, want to create a class to assist our solutions, and not until then this class is desirable publicly available, so we had a local inner class, as the local internal classes and classes are compiled inner member, but its scope is changed, it can only be used in the methods and properties in a the methods and properties will fail.

Learning Mind Map - Summary

Here Insert Picture Description

Published 32 original articles · won praise 9 · views 3145

Guess you like

Origin blog.csdn.net/weixin_43501566/article/details/104685754