143

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

Comments
  • 0
    Java doesn't use pointers or references?
  • 1
    @SweetHuman that's the joke 😏
  • 2
    @FitzSuperUser oh god. I didn't know that about java. This is really sad.
  • 3
    And then C tried to build a JSON API and Java brings him cakes in the psychiatric home he now resides in.
  • 0
    Also Java does use pointers. It just passes all non-primitives by reference(kind of) and all primitives by value.
  • 2
    @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 😅
  • 1
    You should read the sun.misc.unsafe package. Lets you access the heap directly.

    But yes your point is a correct one.
  • 1
    At least java doesn't have to deal with his pointy stuffs dangling about 😂
Add Comment