Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
And then C tried to build a JSON API and Java brings him cakes in the psychiatric home he now resides in.
-
Also Java does use pointers. It just passes all non-primitives by reference(kind of) and all primitives by value.
-
@ChrisCooney java uses References (which are quite similar to pointers if you disregard from pointer arithmetic).
Keep in mind that all objects you create, you create on the heap (using the newkeyword). This fact, together with the fact that there is no "dereference operator" (*in C/C++) means that there's no way to get hold of an object! Since you can't get hold of an object, there's no way you can store an object in a variable. Therefor all variables (except the ones holding primitive types) are of reference-type
Which is why both jokes work 😅 -
You should read the sun.misc.unsafe package. Lets you access the heap directly.
But yes your point is a correct one.
Java and C were telling jokes. It was C's turn, so he writes something on the wall, points to it and says "Do you get the reference?" But Java didn't.
C gets all the chicks and Java doesn't? Because C doesn't treat them like objects.
But I think C could at least give Java some pointers
undefined
c such a stuf java needs some love