Os:windows7 x64
Jdk:jdk-8u131-windows-x64
Ide:eclipse Oxygen Release (4.7.0)
Code:
Class Father {public Father () {This ("Hello"); SYSTEM.OUT.PRINTLN ("Parent-class parameterless constructor"),//this ("Hello"), or//through this () to call the other constructor method of this class, must be the first sentence, placed in the back is not possible}//has a parameter constructor, Stringpublic Father (String str) {SYSTEM.OUT.PRINTLN ("parent class has a parameter constructor, string");}} Class Demo {public static void main (string[] args) {Father f = new Father ()}}
Results:
Java is good, worth learning.
Learning resources: Itcast Video Library. If you have public resources, can share to me, with your resources to learn also can.
Blog post is to watch the video, into thinking written. It's good that the teacher speaks well. Blog bad, is to give the most bitter not serious.
If you think the blog can be improved, leave a message.
The JavaSE8 base uses this () to call the other constructor methods of this class