4 ms·
>You can't take the address of a primitive or object and pass that. Not correct. In Java, if you have an object you take the address and pass it. If you have
by lucio 12y ago
>You can't take the address of a primitive or object and pass that.
Not correct.
In Java, if you have an object you take the address and pass it. If you have a primitive, you pass a copy of the value. Both things are called "pass-by-value" (something that confuses a lot of people).
- jjnoakes 12y agoJava has no notion of "taking the address of an object" because you never have an expression that refers to an object directly. You only have the addresses, so there's no need (or way) to convert objects to their address. And it's all pass by value (for all values you could have - numbers, addresses, booleans, whatever).
- kelnos 12y agoHeh, see why this is so confusing? That is of course what I meant -- it's really that Java, passing-wise, just has primitives and addresses to objects.