• morhp
      link
      fedilink
      arrow-up
      17
      ·
      1 year ago

      Java only has instanceof and getClass, not typeof.

        • sgh@lemmy.ml
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          1 year ago

          Standard C does not have typeof. That’s just a compiler extension…

          Also the equivalent of typeof is most likely decltype or auto.

    • FooBarrington@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      Typescript! Though it’s less useful, since the Typescript types aren’t available at runtime, so you’ll just get object for non-primitive values.

    • LapidistCubed@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      1 year ago

      Probably because Java and C# take much inspiration from C++. They aren’t called “C-based” languages for nothing 😉