At the moment I have an array of
public Module[]moduleArray = new Module[4];
and to output it i’m using
public void displayModules()
{
for (int i = 0; i < moduleArray.length; i++)
{
System.out.println(moduleArray[i]);
}
}
However it’s outputting
Module@1f5e4ae5
Module@67871079
null
null
Implement / override
toString()in theModuleclass. When you see theModule@xyzString representation it is because the only implementation oftoString()for theModuleclass is theObjectclass’s implementation. SinceObjectdoesn’t know anything aboutModuleit just outputs the class name and an instance id.