1. What is the role of private in the encapsulation class?
A: The property and behavior in a class can be modified by private to make the modified property and behavior inaccessible.
General access to member properties: Assign (set), take a value (get get), so access to private variables can be by providing a corresponding setxxx or GetXXX method
。
2. What does the this keyword do in Java?
A: This represents the ontology of the class that is located, and if an external variable calls the class where this is located, this represents the external object. This is typically used to differentiate between member variables and local variables.
3. What is the concept and format of inheritance?
A: Subclasses inherit all the properties and methods of the parent class.
Format: Class Subclass extends parent class {}
4. What is the inheritance of a bit?
(1) Improve the reusable code, improve the efficiency of software development.
(2) The emergence of inheritance allows the relationship between classes and classes, providing a precondition for polymorphism.
What is the role of 5.super?
A: Super is used to represent a reference to the parent class object space contained in the current object.
6. What does rewriting mean? What precautions do you have?
A: When the method name of a method written in a subclass is the same as the method name of a method that inherits from the parent class, the new method overrides the old inherited method.
Note: (1) The subclass method overrides the parent class method and must ensure that the permission is greater than or equal to the parent class permission.
(2) Note: Must be exactly the same: The method's return value type method name parameter list will be the same.
Java Fundamentals Review -7 (Private,this, inheritance)