Results 1 to 3 of 3
Thread: Objects
- 04-18-2010, 06:28 AM #1
Member
- Join Date
- Apr 2010
- Location
- CHITTOR
- Posts
- 2
- Rep Power
- 0
- 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.
Similar Threads
-
Objects
By Silverlining in forum New To JavaReplies: 3Last Post: 11-11-2009, 02:36 PM -
read txt file,with some records, create objects and store objects in tables of a db.
By stamv in forum JDBCReplies: 1Last Post: 01-22-2009, 04:25 PM -
Two Objects
By losintikfos in forum New To JavaReplies: 3Last Post: 11-14-2008, 07:04 PM -
1 to 1 Objects
By this.that in forum New To JavaReplies: 4Last Post: 08-07-2008, 10:09 PM -
how many objects ?
By kevinsong in forum Advanced JavaReplies: 16Last Post: 07-16-2008, 05:59 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks