Class Item
- java.lang.Object
-
- Item
-
public class Item extends java.lang.Object
The Item class represents an item with a name and an image. It provides methods to retrieve the name and image of the item.This class is useful for representing game items, inventory objects, or any other entities that have a name and an associated image.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Returns the name of the item.static java.lang.String
listItems()
Creates a string listing the names of all items in the itemMap.static void
printItemNames()
Prints the names of all items in the itemMap to the console.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the item.- Returns:
- the name of the item.
-
listItems
public static java.lang.String listItems()
Creates a string listing the names of all items in the itemMap. Each item's name is appended to the string builder, followed by a newline character.- Returns:
- A string containing the names of all items in the itemMap, each on a new line.
-
printItemNames
public static void printItemNames()
Prints the names of all items in the itemMap to the console. Write the code Item.printItemNames(); to print the names of all items in the itemMap.
-
-