This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 438

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%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: where all methods gets stored? heap or stack?