This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Sriram, The field and methods of arrays are described in JLS 10.7 Array Members a.length a.clone() // overrides Object.clone() All the methods inherited from Object: a.equals(), a.hashCode(), a.toString(), a.getClass() a.wait(), a.notify(), a.notifyAll() a.finalize() [ February 09, 2004: Message edited by: Marlene Miller ]
Joined: Dec 16, 2003
Thanks a lot Marlene that helped clear things up about array methods. This should help me remember how different lenght is from Strings' length() method(somehow I always overlook this obvious choice in mock exams) -sriram
Joined: Mar 05, 2003
Yes, watch out for a.length and s.length(). I suspect that's one you might see on the exam. I agree, it does help to remember this to understand that array objects have one field and all the methods of class Object (even though they don't have a class definition). There is another thing from the JLS on arrays that helped me. At the beginning of chapter 10 they say An array object contains a number of variables... The variables contained in the array have no names... So I imagine an array object as this amorphous blob containing a sequence of variables (memory locations) without names: a a a. Thank you for letting me know what I said was useful. It helps me to know whether what I say is helpful or not. [ February 10, 2004: Message edited by: Marlene Miller ]