Results 1 to 3 of 3
- 04-18-2010, 06:28 AM #1Member
- Join Date
- Apr 2010
- Rep Power
- 04-18-2010, 09:49 AM #2
in memory references are stored on the stack and objects are stored on the heap. as the name suggest the reference holds the reference (an adress) that points where the object is stored on the heap. the object on the heap contains all memebers, that is member-variables and the member-methods. in java when you declare "MyObject o" only the reference o is created and if you want to have an object on the heap you have to use the reserved word new, example "MyObject o = new MyObject();" now, if you have two object o1 and o2 when you say o1==o2 that you are looking if their references are the same. logically, when o1==o2 is true, then also the objects must be equal. in general for comparing the content of two objects the method isEquals is used.
there are books dedicated to answer your question. so it's not possible to have all details in a short post.
Bannow: welcome the forum. Your question is quite important and as such should be in its own thread, not in a hijacked one. Please feel free to create a new thread and re-ask your question. Thank you for your cooperation.
- By Silverlining in forum New To JavaReplies: 3Last Post: 11-11-2009, 03:36 PM
- By stamv in forum JDBCReplies: 1Last Post: 01-22-2009, 05:25 PM
- By losintikfos in forum New To JavaReplies: 3Last Post: 11-14-2008, 08:04 PM
- By this.that in forum New To JavaReplies: 4Last Post: 08-07-2008, 10:09 PM
- By kevinsong in forum Advanced JavaReplies: 16Last Post: 07-16-2008, 05:59 PM