🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: const in Java

#20000
From: Brian Burton
Date: Tue, 11 Nov 1997 00:00
37 lines
1437 bytes
Eric Nagler wrote:
> 
> Well, in some cases the 'final' keyword can be used:
> 
> class X
> {
>   static int data;
> }
> public class Main
> {
>   public static void main(String args[])
>   {
>     foo(new X());
>   }
>   static void foo(final X ref)
>   {
>     ref.data = 0; // OK
>     ref = new X(); // Error
>   }
> }
> 
> But unlike "const char* a", 'final' does not protect the
> object being referrred to.
> 

Yes.  And isn't that bizarre?  Has anyone found final in parameter
specifications to be useful?  Protecting the reference itself from modification
seems useless to me.  Maybe it's intended use is related to RMI?

All the best,
++Brian

-- 
Brian Burton                        Custom Software Development
Burton Computer Corporation         Java, C++, Orbix, Tuxedo
http://www.burton-computer.com      OO Consulting and Mentoring
Technical Details
Message-ID: <346901F5.1EA6EEF4@burton-computer.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3460FE29.6E0B0E7D@partal.com> <346207B2.3651FB01@burton-computer.com> <01bceecf$1dbb8200$cb00a8c0@pentpro5> <346af095.24672737@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,281638c33db843f0
X-Google-Attributes: gidf74b3,public
From: Brian Burton <brian.burton@burton-computer.com>
Subject: Re: const in Java
Date: 1997/11/11
Message-ID: <346901F5.1EA6EEF4@burton-computer.com>
X-Deja-AN: 288760473
References: <3460FE29.6E0B0E7D@partal.com> <346207B2.3651FB01@burton-computer.com> <01bceecf$1dbb8200$cb00a8c0@pentpro5> <346af095.24672737@forums.borland.com>
Organization: Burton Computer Corporation
Newsgroups: borland.public.jbuilder.java.language