Solved

What does final actually mean?

Posted on 2006-06-29
4
242 Views
Last Modified: 2010-03-31
This is confusing me in a rather big way. If you declare something final, how does that affect it?
0
Comment
Question by:riaancornelius
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 17009029
Hi riaancornelius,

a variable that is final means that it's value cannot be changed once you assign it. A method that is final means that it cannot be overriden and a class that is final means that it cannot be extended by any other class.

Cheers!
0
 
LVL 35

Accepted Solution

by:
girionis earned 125 total points
ID: 17009040
0
 
LVL 9

Author Comment

by:riaancornelius
ID: 17009147
Thanks,
>> a variable that is final means that it's value cannot be changed once you assign it.
That's what was confusing me. Because I see a final JTable I assume you can't change anything in that JTable, but then in practice I see that the JTable's fields can still change.
I get it now. You can change anything in the final object, you just can't point that variable to a new object.

Thanks
0
 
LVL 35

Expert Comment

by:girionis
ID: 17009240
> You can change anything in the final object, you just can't point that variable to a new object.

Exactly, you can change the values but not the reference to the JTable :)
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question