java – meaning of return this

java – meaning of return this

return this returns the current object instance. I dont know what HotOrNot class is, but its clear that this method is defined in that class. In the method, member variable ourHelper is initialised with a new database helper and member variable ourDatabase is assigned a writable database object from that helper – after which the instance of the class is returned – most likely, so that the calls could be chained, e.g.

new HotOrNot(myContext).open().runQuery(some query text)

See the Java language specifications for more information on this keyword.

java – meaning of return this

Leave a Reply

Your email address will not be published.