Solved

What does final actually mean?

Posted on 2006-06-29
4
207 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
Comment Utility
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
Comment Utility
0
 
LVL 9

Author Comment

by:riaancornelius
Comment Utility
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
Comment Utility
> 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now