1 person found this helpful
You can't, like that. You would have to wrap your array in a class and then, when returning the array, you return a copy of the array, rather than the actual array, thereby ensuring that at least the "original" array is unmodified. Be warned, however, that if the elements of the array are objects, the CONTENTS of those objects can STILL be changed, to prevent that you would also have to clone the objects before returning the copy of the array.
I understand u , u want say immutable object , i just want know if i can do that with java syntax
Not as a single statement, like I said you would have to write a wrapper, i.e. your own class, and I am not going to write it for you, make an attempt and post it here if you have problems. Better would be an unmodifiable list as suggested in your cross-post at http://www.java-forums.org/new-java/80626-final-arrays.html
Hehehehe sometimes i can't wait to get the answer hehehe