Constructors can never return a value; the methods you provided are NOT considered constructors because they return int and String respectively.
I modified your code a little bit, now notice that if the method finalTest() on line 1 was a constructor then it will output �Hello World� upon the creation of the object on line 2. But it doesn�t, this means that it is treated as a method and not as a constructor.
[ July 26, 2004: Message edited by: Vicken Karaoghlanian ]
- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
This is not a constructor. Constructors don't have any return type. If you put a return type then it becomes a normal method. So the the code above is a method. Since this class dosn't have a default constructor, the compiler creates a default constructor.
System.out.println( new finalTest() );
Here you have put new keyword inside a print method. You have to remember that when you create an object it returns a reference to that object. In this case you have given it in a print method, so it prints the referrence variable. So what appears as junk is actually a referrence.