Solved

What does final actually mean?

Posted on 2006-06-29
4
235 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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

713 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