Is there some hidden meaning in this code which I don\'t see in java? How can it be useful?
int[] a = new int[1];
than just
int
One difference is that you can write a method that changes its int argument by changing arg[0]
. This trick is used quite a bit in some of the code I've seen. It allows you to, for instance, return a boolean
indicate success or failure and an int
value that serves some other purpose. Without that trick, you'd have to return some sort of object containing the two values.