File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call to function inside construction?

 
raja kanak
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
S Vilish
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1274
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
raja kanak
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot for your efforts.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic