Re: Strings...immutable?
Wojtek wrote:
Chris Dollin wrote :
Since any Java object can contain a reference to another object, a
pointer may pointer to (an object containing) a
pointer.
That is not a pointer pointing to a pointer. That is a pointer to an
object, which just happens to contain other pointers.
Just repeating sense of one unanswered question from this thread, what's
the difference?
A pointer to a pointer in C would look like:
**ptr;
Where the first level point to a pointer, and the second level points to
an object. Java does not have this.
Really? Pointers are low-level objects. Objects pointed by pointer
objects, might be other pointers, or different objects. Technically
there is no significant difference between them.
The same happens in Java when one object points to another object
holding reference to it.
One important difference between "pointers" in Java, and C (or C++) is
in management over all "pointers" in Java performed by JVM -- which cost
a bit, of course -- but thanks to that, there is no possibility to point
something which is not an object or nothing (null), that's all.
The pointers are exposed to the programmer. They just don't
have the API you seem to want.
Not me. I am quite happy without pointers.
You are probably happy with different syntax for using pointers,
management of them for you, and restricted available set of operations
available on them -- just like in Java -- aren't you?
Without pointers you have to decide to use Java build-in primitive types
only, quite sad perspective IMHO... ;)
piotr