Variable change to constant ?
And what about function ?
My question is about what happen deep in the langage. (PHP or java, whatever)
Variable change to constant ?
And what about function ?
My question is about what happen deep in the langage. (PHP or java, whatever)
For further actions, you may consider blocking this person and/or reporting abuse
Head over to the Welcome Thread and greet some new community members!
It only takes a minute of your time, and goes a long way!
nabbisen -
Sloan the DEV Moderator -
Anton Korzunov -
aafrey -
Once suspended, vasilvestre will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, vasilvestre will be able to comment and publish posts again.
Once unpublished, all posts by vasilvestre will become hidden and only accessible to themselves.
If vasilvestre is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Valentin Silvestre.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community π©βπ»π¨βπ» safe. Here is what you can do to flag vasilvestre:
Unflagging vasilvestre will restore default visibility to their posts.
Top comments (5)
I guess you can either ask for a "like I'm five" explanation, or ask what happens deep in the language :P
"final" means that thing doesn't change, simple as that.
As for a deeper explanation considering Java, "final" tells the compiler that this element can be accessed/used without all the usual safe checking, allowing it to use such elements in multi-threaded processes without needing to synchronize it.
There's a great answer here: stackoverflow.com/questions/273695...
Does it prevent extension?
Yes, on it's own, the final modifier prevents a class from being extended. There are some workarounds for that, like delegating the final class calls through another (Foo is final, so you create Bar with the same interface as Foo, make it redirect every call to Foo's methods, and then extend Bar when you need. This is specially useful when you have absolutely no way of changing the code and still want to reuse it's functionalities)
I wrote a post with code examples that explains what final does to classes concretely.
Composition is funny, thanks !