No way, that's the basis. The following program please first analysis, if the results (with the white font is the output) correct, that you are very familiar with the initialization of Java class, is a clearance, if not, then quickly review it.
Package nie.test.extend; Initialization of the
/** Child constructor:
* @author Dotjar
* 1. Parent static field
* 2. Parent static Block
* 3. Child static Field
* 4. Sub-static block * 5. Parent normal Field
* 6. Parent normal Block {}
* 7. Parent Constructor
* 8. Sub-normal field
* 9. Sub-normal Block {}
* 10. Sub-constructor
/
public class Test { public static void Main (string[] args) {
New Son ("s");
}
}
class Father {
static protected String s = "father_static_property_string";//1
Protecte D String B = "father_normal_property_string"; 5
Static {
S = "O";//2
System.out.print ("D");
System.out.print (s);
}
{
b= "R";//6
System.out.print ("a");
System.out.print (b);
}
Father () {
This ("@");
System.out.print ("1");//8
}
Father (String s) {
System.out.print (s);//7
}
}
Class Son extends Father {
public static string s = ' son_static_property_string ';//3
public String b = ' Son_nor Mal_property_string "; 9
StatIC {
s = "J";//4
System.out.print ("T");
System.out.print (s);
}
{
b = "3";//10
System.out.print ("6");
System.out.print (b);
}
Son () {
System.out.print (".");//11
}
Son (String s) {
This ();
System.out.print ("com");//12
}
}
Test your output, you can select the next row with the mouse to check.