So for my local data structure I have the following
DataStructure ds = new DataStructure();
//Examples to put in the Data Structure "ds"
ds.menu_item.put("Pizza", new DescItems("A Pizza",2.50,4));
ds.menu_item.put("Hot Dog", new DescItems("A yummy hot dog",3.50, 3));
ds.menu_item.put("Corn Dog", new DescItems("A corny dog",3.00));
ds.menu_item.put("Unknown Dish", new DescItems(3.25));
The DataStructure class has a LinkedHashMap implementation such that
LinkedHashMap<String, DescItems> menu_item = new LinkedHashMap<String, DescItems>();
And finally the DescItems class is
public final String itemDescription;
public final double itemPrice;
public final double itemRating;
public DescItems(String itemDescription, double itemPrice, double itemRating){
this.itemDescription = itemDescription;
this.itemPrice = itemPrice;
this.itemRating = itemRating;
}
There are other constructors to account for no itemDescription and/or itemRating
I'm trying to apply a method to check to see if a value has itemRating other than 0 (0 indicating no rating)
But specifically I came across this problem:
DescItems getC1 = (DescItems)ds.menu_item.get("Pizza");
System.out.println(getC1.toString());
Only prints out reference information like DescItems@142D091
What should I do to get a specific object variable instead of referencing the object?