aspose file tools*
The moose likes Beginning Java and the fly likes Constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructors" Watch "Constructors" New topic
Author

Constructors

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 180
Hello Everyone!!!
I have read somewhere that the constructor's first statement is either "super" or "this" . We can not use both of them together. But i implemented this concept.. it turned out to be completely wrong.
Look at the following code :


It is printing 1,2,3 but it should not go to its super class !!! because first line of the constructor is "this"!!!
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
What you are forgetting is that the constructor you are calling with "this" also has a call to super that is inserted there for you.
Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 180
E Armitage wrote:What you are forgetting is that the constructor you are calling with "this" also has a call to super that is inserted there for you.


oh yes you are right.. silly me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructors