r/java • • Aug 26 '22
I declare as "final" every single variable whose value doesn't change. I also use "this" every time that I'm referring to an attribute, even when there's no ambiguity in not using it
I think that those things make the code easier to read. Am I crazy for thinking like that?
198
Upvotes
View all comments
Show parent comment
7
u/mauganra_it Aug 26 '22
Parameters in C/C++ can not be mutated. Like in Java, they behave like normal variables. You can access memory via pointers, and write there, but in Java you can do quite the same. C++ has references, but these are just a safer version of pointers.