Breaking News: Grepper is joining Read the official announcement!
Check it out

If there are no pointers in Java, then why do we get NullPointerException?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 1/10


More Related Answers

  • null pointer exception
  • pointers in java
  • java catching nullpointerexception
  • java pointer
  • Fix NullPointerException
  • java.lang.nullpointerexception
  • SET TO NULL pointer c++
  • spring environment null pointer exception
  • nullpointerexception
  • nullpointerexception
  • NullPointerException
  • NullPointerException
  • NullPointerException
  • Why there are no pointers in Java?
  • resolve null pointer exception java 8
  • NullPointerException
  • how to use a try catch for a null pointer exception in java
  • nullpointerexception

  • If there are no pointers in Java, then why do we get NullPointerException?


    In Java, the pointer equivalent is Object reference.

     When we use a . it points to object reference.

     So JVM uses pointers but programmers only see object references.

    In case an object reference points to null object, and we try to access a method or member variable on it, then we get NullPointerException.

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: get java pointers
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.