At 03:59 PM 6/26/2002 +0000, you wrote:
>In looking through Avalon source code I keep running into final in other
>places -- method parameters:
>
>         public ComponentException( final String message )
>
>or in local variable definitions:
>
>     public Component lookup( final String role )
>         throws ComponentException
>     {
>         final Component component = (Component)m_components.get( role );
>
>It's my understanding that final is to make a variable unmutable through
>typechecking.

Sort of. It makes the reference to object immutable. (The object may still 
be mutable). The reason for this is to avoid potential errors that can 
occur or to eliminate bad programmings practices.

ie You should never alter a parameter reference in java and making it final 
enforces this.

Some older JVM showed a performance increase but you should not see this 
post 1.1 JVMs.

Cheers,

Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
              - John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to