KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In Java, you can qualify local variables and method parameters with the final keyword. public static void foo(final int x) { final String qwerty = "bar"; } Doing so results in not being able to reassign x and qwerty in the body of the method. This practice nudges your code in the direction of immutability which is generally considered a plus. But, it also tends to clutter up code with "final" showing up everywhere. What is your opinion of the final keyword for local variables and method parameters in Java?
Tags (comma-separated)
Save Edits
Cancel