I have the following code:
public class DTTMCatalog
{ //open class DTTMCatalog
private catalogItems items[]; //array for items stored in the DTTM catalog
public DTTMCatalog()
{
items = new catalogItems[15];
items[0]= new catalogItems("song", "Hannah Jane");
items[1]= new catalogItems("song", "Hard Day's Night");
items[2]= new catalogItems("song", "Crazy");
}
public void getCatalog()
{
System.out.print ("Here are the items in the DTTM Catalog: \n");
System.out.printf("%s%8s%8s\n","Index", "Type", "Title");
for(int counter = 0; counter < 3; counter++)
System.out.printf("%15s%28s\n", counter, items[counter]);
}
}
public class catalogItems
{
private
String itemType;
private String title;
public catalogItems(String theItemType, String theTitle)
{
itemType = theItemType;
title = theTitle;
}
}
The problem is that my print output looks like this:
1 catalogItems@117a8bd
How do I get it to print the contents of the array rather than the hashcode?
Thanks
Patty