Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: Another question on Java keyword "this". Date: Fri, 15 Apr 2016 14:05:17 +0100 Lines: 23 Message-ID: References: <7d6a2a1e-bf53-472c-8ec2-2c92a0b5f73e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net hV1E5bElVksfm0nw0DjCZAPCbdHNz+N3b6oSh9Dt9fEPTfuo3b Cancel-Lock: sha1:b7A25fF+xXIpmiPSFokKn9vGXiw= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:34140 On 15/04/16 13:31, cdalten@gmail.com wrote: > So would keyword "this" in > > mTransparencyBar.setOnSeekBarChangeListener(this); > > refer to an instance of OnSeekBarChangeListener? > > Just curious because > > mTransparencyBar.setOnSeekBarChangeListener(this); > > is in the same method. > > It refers to the object on which the method containing that statement was invoked. That method is a member of the class GroundOverlayDemoActivity, so it must refer to an instance of that class. It does not refer to an instance of OnSeekBarChangeListener. OnSeekBarChangeListener is an interface and cannot be instantiated. It must refer to an instance of a class which has implemented the interface OnSeekBarChangeListener.