what is final, what is its implication on method,class and variable?
Utilisateur anonyme
final is a keyword in Java and it can be used with method, class and variable. 1. final method Making a method in final means that it cant be overridden. So, when you does not want any subclass to override any method definition mark it as final. 2. final Class Marking a class a final restricts it from being inherited. So if you make class final you can have any subclass from it. e.g., String class is final in Java 3. final variable 2 version exists for this. If the variable is primitive type then the value assigned to it cant be changed if it is marked as final. For reference type variable the scene is different , if a reference type variable is marked final then it cant point to object other than it was assigned during initialization. Note the data members of the Object itself can be modified though.