File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Where do primitive types live?" Watch "Where do primitive types live?" New topic

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

Joined: Jul 26, 2006
Posts: 12
x will be on Heap & y on stack
I agree. Here's the link:
subject: Where do primitive types live?
It's not a secret anymore!