package com.cy.gouwuche.car; import java.util.Objects; //商品 public class Goods{ //名字 private String name; //编号 private String number; //价格 private double price; public Goods(String name, String number, double price) { this.name = name; this.number = number; this.price = price; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Goods goods = (Goods) o; return Double.compare(goods.price, price) == 0 && Objects.equals(name, goods.name) && Objects.equals(number, goods.number); } @Override public int hashCode() { return Objects.hash(name, number, price); } @Override public String toString() { return "Goods{" +
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)