This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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: