Testing for beginners
I tested Java programming language design on my own yesterday. I don't quite remember the class initialization process. I reviewed it by the way.
A test question is also prepared. Distribute your email to the output. If the output is correct, the analysis is correct.
This is the foundation. The following program analyzes the result first. If the result is correct (the result is output in a white font), you are familiar with Java class initialization. If not, review it.
Package nie. test. extend;/** sub-constructor initialization process: * @ author dotjar * 1. parent static domain * 2. parent static block * 3. sub-static domain * 4. sub-static block * 5. parent common domain * 6. parent common block {} * 7. parent constructor * 8. sub-common domain * 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 protected 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_normal_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 }}
After testing your output, you can select the next line and check it.
Here:Dotjar@163.com