Java References and C pointers differ in exactly two points:
- There's no pointer-arithmetic for the former.
- And you cannot create a Java reference to whatever you want, you can only copy those saved somewhere accessible (static fields, fields of objects, local variables) or returned by function-invocations (like constructor-calls), which thus all refer to Java objects (never to basic types like references,
char
,int
and so on).
Someone wrote that References are strongly typed, because you cannot force the compiler to treat an int*
as a char*
.
Completely aside from the fact that that particular conversion is actually safe, there is no polymorphism in C, so that comparison is a non-starter.
Certainly, Java is more strongly-typed than C, not that that's a feature of C pointers vs Java references, you need to use the JNI to break type-safety (aside from disregarding generic restrictions), but even in C you have to force the compiler.
Someone wrote that Java references might be implemented as C pointers, to which I say sure, as they are strictly less powerful, on 32Bit machines they typically are, if the JVM is implemented in C. Though on 64Bit machines, they are normally compressed ordinary-object-pointers ("compressed OOPs") to save space and bandwidth.
Anyway, those C pointers need not be equivalent to hardware addresses either, even if they typically (>99% of implementations) are for performance reasons.
Finally, that's an implementation detail which is not exposed to the programmer.