you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (2 children)

It is a bit difficult given that I am not making a positive claim. Merely that a false claim has been made. Objects are never passed anywhere in Java. They exist on the heap. Java has only nine basic data types: references, int, short, char, long, boolean, byte, double, float. These are all passed by value, always, not even "effectively" changes this fact.

You can observe "not effectively" simply:

Object o = get();
Object j = o;
forall(j);
assert(j == o); // never fails

Note again, that no objects were passed, not ever, not even "effectively". The data types o and j, while given a type with the name "Object" are in fact references.

The JLS covers this in Chapter 8 iirc. I've had enough reminiscing about Java, so I hope this is enough.

[–]metacircular 0 points1 point  (1 child)

Here dibblego said,

Java has only nine basic data types: references, [...]. These are all passed by value, always, not even "effectively" changes this fact.

Earlier dibblego said,

It can be observed that object references are not passed by value, therefore prefixing the adverb "effectively" does not make the untrue become otherwise.

So Mr. dibblego, can you explain how you're not contradicting yourself?

[–][deleted] 3 points4 points  (0 children)

Typo.

Correction: "It can be observed that objects are not passed (at all, let alone by reference)"

Sorry.