I'm currently working with a SCJP study guide and am staring at a rule that I can't seem to agree with.
In addition to the constructor (with no parameters), you can also define nondefault constructors with parameters. However, the constructor name stays the same: the class name. The constructor may be called from inside the class where it is defined or from outside the class, using the following rules:
Outside of the class in which a constructor is defined, the constructor can be called only with the new operator, that is, when you want to create an instance of the class. For example, a code expression new A() in the class B will create an instance of the class A.
Inside the class where a constructor is defined, the constructor can be called from within another constructor, and not from anywhere else.
To me rule #2 means one of two things, Either:
1) A constructor, in order for it to be called from within another constructor, must be called from within the class in which it is defined.
OR
2) If a constructor is called from within the class that defines it, it must be called from within another constructor.
I can write code that violates both interpretations of this rule and compiles fine. Does anybody know what this is supposed to be referring to?
Thanks