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

Mock question doubt...

 
Bram Maes
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The correct answer is "This doesn't compile".
This invocation will search for a function named test. It does not invoke the overloaded test() constructor.

I don't get this. Why is that ?? How can you do what's meant to do here ?

Thanks.
 
Anand Loni
Ranch Hand
Posts: 150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

First statement in Constructor can only be:

1) Call to superclass's constructor by super call.
2) Call overloaded constructor using this call.

Thats why its will search for method named same as class name.

Regards,
Anand
 
Bram Maes
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So this(2) should work then ?
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup
 
Bram Maes
Ranch Hand
Posts: 32
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are the kind of questions I hate. Really those subtle differences. Half a second losing your attention and bang...

And of course thanks a lot for the clarification!
[ October 27, 2006: Message edited by: Bram Maes ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic