🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8346

Re: extending interfaces and final variables in inner classes

#8346
From: Tor Iver Wilhelmsen
Date: Sun, 25 Mar 2001 19:08
21 lines
1668 bytes
"Yonatan Taub" <yonatanta@bashan.co.il> writes:

> Why does the compiler issues a compilation error when using the syntax
> 
> public MyInterface implements AnotherInterface

Because your interface cannot - by the nature of an interface -
provide an implementation - as in method bodies - of the other
interface. Thus the keyword doesn't make sense in that context.

> When referring to outer objects or variables within an inner class they have
> to be declared final otherwise you get a compilation error.
> What's the reason for that?

Because local variables are passed by value to the constructor of the
inner class, and to ensure that the programmer will not believe any
changes made to them after construction of the "inner object" will
have effect there, the variables have to be final.

If you have a parameter that you need to be non-final, just make a
final "alias" for it with another local variable.
Technical Details
Message-ID: <uu24h64zf.fsf@sds.no>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!139.105.4.252
References: <3abbda8f_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,634447406d21cfca
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-25 12:08:07 PST
Sender: towi@SDSA1761
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: extending interfaces and final variables in inner classes
References: <3abbda8f_2@dnews>
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Date: 25 Mar 2001 21:08:52 +0200
Message-ID: <uu24h64zf.fsf@sds.no>
Lines: 21
X-Newsreader: Gnus v5.5/Emacs 20.3
NNTP-Posting-Host: 139.105.4.252
X-Trace: 25 Mar 2001 11:08:51 -0800, 139.105.4.252
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!139.105.4.252