This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Where do primitive types live? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Where do primitive types live?" Watch "Where do primitive types live?" New topic
Author

Where do primitive types live?

Javier Sanchez Cerrillo
Ranch Hand

Joined: Aug 02, 2006
Posts: 152
--------------------------------------------------------------------------------
It is said that "instance variables" and objects lives in the "Heap" and local variables lives in the "Stack".

But what about primitive types???. Are the same rules are aplied???

class Javier {
int x = 10;
public static void main(String[] args) {
int y = 20;
}
}

Where do x and y live?


SCJP 5.0 95%<br /> <br />The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.
john cahil
Greenhorn

Joined: Jul 26, 2006
Posts: 12
x will be on Heap & y on stack
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where do primitive types live?
 
Similar Threads
Interesting mock question about arrays and postfix
Usage of "this" keyword
Memory Spaces for primitive types and Objects
Passing objects by reference or value???
java data types initializing