Article View: borland.public.jbuilder.java.language
Article #19477Re: Inner Classes & this$0
From: Steve Sommers
Date: Tue, 27 Jan 1998 00:00
Date: Tue, 27 Jan 1998 00:00
70 lines
2573 bytes
2573 bytes
According to Barry Boone's Java Certification exam guide the only way to
reference the current instance of the outer class is:
<i>outerclassname.this</i>. He doesn't mention <i>this$0</i> anywhere.
This is only one source, naturally, but it seems the method Boone mentions
should work for any environment.
Barry Donovan wrote:
> Hi,
>
> I'm experiencing problems with Inner classes and this$0. The code
> compiles OK with
> the Sun and Symantec Compilers but not under JBuilder - it seems I
> cannot call any of the
> outer class methods or access any of the outer class attributes. I
> see a few people have previously
> mentioned problems with Inner classes & the JBuilder compiler but
> noone from Borland has
> made any comment.
>
> Can someone please tell me what is wrong with this piece of code?
>
> Thanks for your help in this matter,
> Barry Donovan.
>
> A.java:
>
> package com.blah.blah;
>
> public class A extends Object
> {
> public A()
> {
> }
>
> public void someMethod()
> {
> }
>
> class B
> {
> public B()
> {
> this$0.someMethod(); // Call the outer class
> someMethod as opposed to inner class.
> }
>
> public void someMethod()
> {
> }
> }
> }
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Barry Donovan
> Chief Software Engineer
>
> Nifco Synergy Ltd. http://www.nifcosynergy.com
> E-MAIL: barry@nifcosynergy.com
> Phone: (604) 986-0889 ext. 133
> Fax: (604) 986-0869
> ADDRESS: 2030 Marine Drive, Suite 100
> North Vancouver, B.C. Canada V7P 1V7
>
> Bite my lips and close my eyes - take me away to Paradise.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID:
<34CEB378.69529425@pop3.concentric.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34BC0487.9EBB9687@nifcosynergy.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,af8275ac87b32045 X-Google-Attributes: gidf74b3,public From: Steve Sommers <ssommers@pop3.concentric.net> Subject: Re: Inner Classes & this$0 Date: 1998/01/27 Message-ID: <34CEB378.69529425@pop3.concentric.net> X-Deja-AN: 319876017 Content-Transfer-Encoding: 7bit References: <34BC0487.9EBB9687@nifcosynergy.com> Mime-Version: 1.0 Reply-To: ssommers@concentric.net To: Barry Donovan <barry@nifcosynergy.com> Content-Type: text/plain; charset=us-ascii Organization: None Newsgroups: borland.public.jbuilder.java.language