This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes What is this() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is this() method" Watch "What is this() method" New topic
Author

What is this() method

jo sim
Ranch Hand

Joined: Apr 24, 2006
Posts: 37
Hi I want to know what is this() can someone just give me a small example of how it works or a site where i can read more about it. Please

thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It is an explicit call to the no arguments constructor of an object. For example:


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See Calling constructors from constructors from Eckel's Thinking in Java.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
sven studde
Ranch Hand

Joined: Sep 26, 2006
Posts: 148
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What is this() method
 
jQuery in Action, 3rd edition