I have a class called Ball, and i want to call a method called update in a class called MagicBallImage. Below is the method isVisible() in the Ball class, from which I am trying to call the method update, but I am getting an error saying:
Ball.java:58: non-static method update() cannot be referenced from a static context.
MagicBallImage.update();
Ball Class
public boolean isVisible()
{
if (magicBallState != 1)
{
return true;
MagicBallImage.update();
}
}
Anyone know how to solve this?
It’s telling you that you’re trying to call a non-static method without a class instance. You either need an instance of
MagicBallImageto call the method on, or you need to convert the method tostatic.