Is there any reason why one would declare a array final?
say something like this
final int[] array={1,2,33,21,11};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It provides an invariant that the assignment of ‘array’ can’t be changed. (When looking at code I can assume ‘array’ won’t get reassigned). However nothing stops an element from being changed. Ex. array[2] can be changed from 33 to 25.