Results 1 to 10 of 10
Like Tree2Likes
  • 1 Post By gimbal2
  • 1 Post By allaudin

Thread: Java Objects in Heap

  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,869
    Rep Power
    5

    Default Re: Java Objects in Heap

    Where else?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default Re: Java Objects in Heap

    In a cupboard?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Java Objects in Heap

    on stack ???

  5. #5
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,869
    Rep Power
    5

    Default Re: Java Objects in Heap

    Well Java doesn't have one (at least not like you are vaguely referring too such as it exists in C/C++), so that's why everything goes on the heap. Another puzzle solved!
    allaudin likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Java Objects in Heap

    Really, I was thinking about it whole day What about primitive types ?

  7. #7
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,869
    Rep Power
    5

    Default Re: Java Objects in Heap

    No idea, I suggest you look it up in the virtual machine specifications if you really MUST know.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: Java Objects in Heap

    Ok thanks gimbal2, i've just downloaded jvm pdf .. start reading from tomorrow :)
    gimbal2 likes this.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,945
    Rep Power
    19

    Default Re: Java Objects in Heap

    If it's in a method block it's stored on the stack.
    If it's an attribute of an object then it's stored on the heap (as part of the object).

    ETA: Of course, that shouldn't stop you reading up on these things...:)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

Similar Threads

  1. How to find the objects are created in heap only?
    By akiravelmont in forum New To Java
    Replies: 1
    Last Post: 12-07-2012, 06:47 PM
  2. Max Heap in Java?
    By proggrammer in forum New To Java
    Replies: 4
    Last Post: 06-15-2012, 09:04 AM
  3. Java heap
    By ultras in forum New To Java
    Replies: 1
    Last Post: 01-15-2011, 06:46 PM
  4. Replies: 5
    Last Post: 08-13-2010, 10:04 AM
  5. when objects are removed from heap
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-09-2007, 04:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •