Pointers in Java

前端 未结 9 2060
梦毁少年i
梦毁少年i 2020-12-05 16:28

C++ supports pointers whereas Java does not. But when many programmers questioned how you can work without pointers, the promoters began saying \"Restricted pointers.” So we

9条回答
  •  我在风中等你
    2020-12-05 17:03

    The Java language specification has this to say about the matter:

    Java Language Spec §4.3.1
    The reference values (often just references) are pointers to these objects, and a special null reference, which refers to no object.

    For those who fear delving into documentation, the presence of e.g. Java’s NullPointerException should be a strong indication that Java does have pointers.

    In short, the question is meaningless because it is based on a totally incorrect assumption that, quoting the OP, “Java does not pointers” – as proven above, that is technically bullshit.

    See also James Kanze’s answer.

    This answer can best be viewed as just supplying the necessary references to James’ answer.

    Cheers & hth.

提交回复
热议问题