📄 product.java
字号:
/*
* Product.java
*
* Created on 2008年6月2日, 上午9:33
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package stateful;
import java.io.Serializable;
/**
*
* @author teacher
*/
public class Product implements Serializable{
private String name;
private double price;
/** Creates a new instance of Product */
public Product() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public boolean equals(Object obj) {
boolean retValue = false;
if(obj instanceof Product){
Product p = (Product)obj;
retValue = p.getName().equals(name) && p.getPrice() == price;
}
return retValue;
}
public int hashCode() {
return name.hashCode() ^ new Double(price).hashCode();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -