Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Call to function inside construction? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Call to function inside construction?" Watch "Call to function inside construction?" New topic
Author

Call to function inside construction?

raja kanak
Ranch Hand

Joined: Oct 18, 2006
Posts: 135
I got this question from www.jchq.net

It compiles and run. I read that inside constructor, we can call only this and super then how come findOut(y) call works?

If my understanding is wrong, please correct. Thanks for any help.

rajakvk


live
S Vilish
Ranch Hand

Joined: Feb 06, 2007
Posts: 39

I read that inside constructor, we can call only this and super


We can call any other method of the class inside the constructor.

Vilish
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Hi raja,

it is true that in the first line of the constructor, we can only this or super.

Remember however, that if you don't put a call to this or super, the compiler provides an invisible call to super:

Yours,
Bu.
[ February 17, 2007: Message edited by: Burkhard Hassel ]

all events occur in real time
raja kanak
Ranch Hand

Joined: Oct 18, 2006
Posts: 135
thanks a lot for your efforts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call to function inside construction?
 
Similar Threads
Garbage Collection
confused............
GC
which objects are eligible for Garbage Collection?
can anyone explain this?