This happens if you are defining an object variable and do not initialize it.
For example. You wrote a class MyClass and use it as follows:
MyClass myClass;
myClass.doSomething();
will give the error.
MyClass myClass = new MyClass();
myClass.doSomething();
would work.