🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: changing reference in a method

#7527
From: Tor Iver Wilhelmsen
Date: Tue, 19 Jun 2001 08:55
14 lines
1519 bytes
"Yonatan Taub" <yonatanta@bashan.co.il> writes:

> Since you can't assign the reference to another object anyway, what's the
> point of declaring an argument as final?

Contract. You _can_ normally reassign a parameter (they are local
variables), declaring it as final means that the value won't change
during the method. (Of course, the method could just make a non-final
copy and work on that, but that's beside the point.)

The main reason is that anonymous inner classes created in the method
are passed the value of any local variables they use, and to ensure
the programmer knows what they are doing, a "final"-requirement
signals that the value is "important".
Technical Details
Message-ID: <ud780onl9.fsf@sds.no>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3b2ccfc1_1@dnews> <3b2cd6b8_2@dnews> <3b2cde4d$1_2@dnews> <3b2d0dfa_2@dnews> <3b2e2da2_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,de239f43bd446264
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-19 02:09:54 PST
Sender: towi@SDSA1761
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: changing reference in a method
References: <3b2ccfc1_1@dnews> <3b2cd6b8_2@dnews> <3b2cde4d$1_2@dnews> <3b2d0dfa_2@dnews> <3b2e2da2_1@dnews>
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Date: 19 Jun 2001 10:55:46 +0200
Message-ID: <ud780onl9.fsf@sds.no>
Lines: 14
X-Newsreader: Gnus v5.5/Emacs 20.3
NNTP-Posting-Host: 139.105.4.252
X-Trace: dnews 992940943 139.105.4.252 (19 Jun 2001 01:55:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!grolier!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!dnews