During The learning process in this chapter, I learned about the concept of inheritance, which is a core technology in Java programming and a mechanism for building new classes with existing classes. When a new class is defined to inherit a class, the new class inherits the method and domain of the class, adding new methods and fields to the new class to accommodate the new situation.
The main advantages of inheritance are: 1: Code reusability 2: can easily customize subclass 3: The domain and methods of the parent class are available for subclasses 4: Designing applications becomes simpler
1: By extending the superclass, you only need to point out the differences between subclasses and superclass. You can increase the domain, add methods, or override the superclass in a subclass, but you must never delete any fields and methods of the superclass.
2:super is a unique keyword that instructs the compiler to call a superclass method, which is not a reference to an object and cannot be assigned a super to another object variable. The Super keyword generally has two uses: one is to call the superclass method, and the other is to call the superclass constructor.
3: If the subclass constructor does not explicitly call the constructor of the superclass, the superclass default constructor is called automatically
There is also a sense of polymorphism: polymorphism refers to the phenomenon that the same symbol in a program has different interpretations in different situations.: 2: A domain or method defined in a superclass, after which the quilt class inherits, can have different data types or behave differently.
3: This makes the same domain or method have different semantics in the superclass and its subclasses. 4: Methods in the superclass can be overridden in subclasses.
Because of this chapter a lot of knowledge is not very thorough, so this week's blog experience can only write these, I will be good to understand that they do not understand, as soon as possible to learn to keep up with the progress of teaching
201671010106 2016-2017-2 "Java Programming" learning experience 4