• Post Reply Bookmark Topic Watch Topic
  • New Topic

primitives and objects  RSS feed

 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"You never pass the object. All objects are stored on the heap. Always."

I was reading "camp fire stories" .
The quote was cut from "pass by value" article.

All objects have a reference on the heap (a number).So how are primitive values stored in ram?

I put a primitive value to a method and its not changing the value when its pair changed inside the method.If i put an object into a method the outter object is affected.Why was not primitive affected?

I have read "pass by value" article.I did not understand anything.
Author was tring to tell something with cups.But understanding the cups example never means understanding how the primitives work.

One more , is String an object or primitive?
[ September 02, 2006: Message edited by: sinasi susam ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an advanced question - moving to beginners.

You might also want to search the forum, as this is a very frequently asked question, and there are already a lot of good explanations in the archive.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
... You might also want to search the forum, as this is a very frequently asked question...

A good start is this thread.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!