I want to get information to print to the terminal about a specific object, but I can't tell which instance of the object the information is coming from.
What I want this code to print is:
cat1: current X:1106
OR
cat2: current X:1106
This is what is printing:
CatClass: current X:1106
This code is where I create the objects in a subclass of world.
This is a line of code in the act method of the CatClass.
CatClass cat1 = new CatClass();
CatClass cat2 = new CatClass();
public void populateAlly()
{
addObject(cat1, 1600, 247);
addObject(cat2, 3750, 247);
}
System.out.println(getClass().getName() + ": current X: " + getX());
