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

Output for a Jave prog

Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88


Hi , The above code produces the following output


A1
A1
C3

Please explain how the above ouput is printed..What is the use of this()
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18715
    
  40

QuoteYourSources


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Rajiv Chelsea wrote:
What is the use of this()


OK, let's have a clue: this(args) call the overloaded constructor of the class. In your case this() calls the no-args constructor of the same class! Try it, you'll get it!


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

this() is used call the another constructor (as per passed arguments) of the same class and super is used to call superclass constructor. What you have not understand in this?


Life is easy because we write the source code.....
Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
Thanks all!
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2495
    
    8

QuoteYourSources

If you post questions on JavaRanch, You have to tell us where you get them from.


OCUP UML fundamental and ITIL foundation
youtube channel
Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
I got these from a scjp test engine i downloaded
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

Which one?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rajiv Chelsea
Ranch Hand

Joined: Jun 15, 2010
Posts: 88
I downloaded it from Khalid Mughals webpage
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Output for a Jave prog