Hi everyone,
I have a doubt from K&B, Chapter 2- Constructors and Instantiation:
"Every constructor has, as its first statement, either a call to an overloaded constructor (this()) or a call to the superclass constructor (super()), although remember that this call can be inserted by the compiler."
This is not necessarily true.
I a simple class:
class tester{
tester(){
System.out.println("in tester()");
}
tester(int i){
System.out.println("in tester(int i)");
}
public static void main(
String[] args){
tester t = new tester(10);
}
}
Output:
in tester(int i)
In this code example, this() is not invoked from tester(int i) constructor.
Am i missing something here? I am giving
SCJP in 9 days time and i guess i have lost some logical reasoning to tension!
Please help.
Thanks,
Meher