☕ Java
Beginner
What does the final keyword do in Java?
Answer
The final keyword has different meanings depending on where it is used. A final variable can be assigned only once — it is a constant. If it is a primitive, the value cannot change; if it is a reference, the reference cannot be reassigned (though the object's state can still change). A final method cannot be overridden by subclasses. A final class cannot be subclassed — for example, String, Integer, and Math are all final. Making a class final prevents inheritance and can be used for security or design reasons when the class's behavior must not be altered.