This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Just wondering what gives an array of primitive type its "length" property? i.e. when I have - int arr = new int; How is the call arr.length resolved by the compiler, as type of array here is int? TIA, - Manish p.s. I hope I am not flooding the forum with silly questions.
Hey Manish the compiler uses a special bytecode to get the length of an array objetc: arraylength. Though the length of an array is a field of the array object, compiler doesn't use the normal getfield or getstatic bytecodes: