①for-each Loop ② Inheritance concept ③ Full class name ④ method rewrite
First, For-each cycle
When iterating through each element in the collection, one of the for loops
int [] A = {n/a};
for (int result:a) {
SYSTEM.OUT.PRINTLN (result);
}
All in turn, but no details are processed
Ii. inheritance
The relationship of Is-a
Subclass inherits all the properties and methods from the parent class, and the inherited access modifier limits
But constructs cannot be inherited, and the construction of the parent class will work in the construction
Pros: ① multiplexing ② Extended parent class properties and methods
Java is a single inheritance, a class has only one parent class
Single inheritance: The hierarchy structure is clear, the richness is not high, so Java in the interface to make up for more
Multiple inheritance: C + +, such as high richness, may appear a complex network and other inheritance relationships, the structure may not be clear
Third, class full name, class qualified name
①import Com.lovo.Son;
Son a = new Son ();
②com.lovo.son a = new Com.lovo.Son ();
Iv. Method Rewriting
Subclasses re-implementing methods of the parent class
① method Name, parameter list, return type all consistent
The access modifier for the ② subclass cannot be smaller than the parent class
Public > Private
2.24 Java Basics Summary ①for-each loop ② Inheritance concept ③ Full class name ④ method rewrite