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.
What do you mean b default sizes? The size of an object or string depends on what the object is or what is in the string. HashMap and ArrayList??? I you trying to find the differences or whic one will be appropriate for you to use. Any good textbook, will have some information on these.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: May 29, 2001
I've thumbd through Eckel's book and Mugal's book and cannot find the answer that I'm looking for. I am referring to the size of: new Object(); new String(""); new HashMap(); new ArrayList();
Roger, I don't think there's any way of directly knowing the "size" of an object in Java. (Someone please correct me if I'm wrong.) If you are comparing objects you can use the == operator (identity) or equals method (equality, however defined for the given object), depending on what you're after. If you need to know what the class of a given object is, you can use the instanceof operator (or in some cases you may want to use the class's Class object). [ June 26, 2002: Message edited by: Michael Matola ]