Answer Posted / user
One scenario where final is important, when you want to prevent inheritance of a class, for security reasons. This allows you to make sure that code you are running cannot be overridden by someone.
The best example is
public final class String
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is sorting in java?
Why we used break and continue statement in java?
Why is multithreading important?
What are the differences between c++ and java?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
What are passing parameters?
What is final method?
What is the purpose of declaring a variable as final?
What is an empty list in java?
What are conditionals and its types?
worst case complexities of Quick sort and Merge sort.
Why you should not use singleton?
What is an escape character in java?
What is use of arraylist in java?
Why does java not allow multiple public classes in a java file ?