?
Solved

What does final actually mean?

Posted on 2006-06-29
4
Medium Priority
?
244 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

771 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