item.java

来自「关于Java使用的各种小程序,有文件操作」· Java 代码 · 共 51 行

JAVA
51
字号
/**   An item with a description and a part number.*/public class Item{    /**      Constructs an item.      @param aDescription the item's description      @param aPartNumber the item's part number   */   public Item(String aDescription, int aPartNumber)   {        description = aDescription;      partNumber = aPartNumber;   }   /**      Gets the description of this item.      @return the description   */   public String getDescription()   {        return description;   }   public String toString()   {        return "[descripion=" + description         + ", partNumber=" + partNumber + "]";   }   @LogEntry(logger="global") public boolean equals(Object otherObject)   {        if (this == otherObject) return true;      if (otherObject == null) return false;      if (getClass() != otherObject.getClass()) return false;      Item other = (Item) otherObject;      return description.equals(other.description)         && partNumber == other.partNumber;   }   @LogEntry(logger="global") public int hashCode()   {        return 13 * description.hashCode() + 17 * partNumber;   }   private String description;   private int partNumber;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?