GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes where all methods gets stored? heap or stack? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "where all methods gets stored? heap or stack?" Watch "where all methods gets stored? heap or stack?" New topic
Author

where all methods gets stored? heap or stack?

rohit shekhar
Ranch Hand

Joined: Mar 05, 2010
Posts: 32
whenever we creates any method like main() etc where it gets space in stack or in heap?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Objects get created in the heap. Each method call and its associated parameters are maintained in a call stack.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Prithvi Sehgal
Ranch Hand

Joined: Oct 13, 2009
Posts: 774
methods are placed on stack. Only objects are created on heap as quoted above.

HTH,


Prithvi,
My Blog, Follow me on Twitter,Scjp Tips, When you score low in mocks, Generics,Scjp Notes, JavaStudyGroup
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 444
    
    1

Methods are always stored onto the stack
if you want to know a little then use the K & B book and check the EXception Handling chapter where the stack of method calls when an exception is thrown is shown

SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
 
 
subject: where all methods gets stored? heap or stack?