The java.lang.NullPointerException checked exception is thrown when you try to use an object without a reference, in simple words, this means: you are trying to use an object variable without a value.
Remember that the bit of the hold variable is a primitive and non-primitive do variable, but the difference is that the primitive variable holds the value in bits, but the non-primitive variable holds bits (for example, direction) to access the object in memory, and when it is no longer used, GGC (Garbage Colector) kills him.
source share