In java, passing object data type to a method can be the same as pass by reference in c/c++ when passing a pointer data type to a method. Pero java man gud ni, in java, there is no such thing as a pointer data type. There are only primitive data types and object data types.
Yeah, its true, primitive values are stored in the stack while the objects are stored at heap.
Originally Posted by
boxingfan529
as far as i remember, only objects are passed as reference. primitive ones are not. primitives are loaded in the stack and not in the heap memory.