product.java

来自「ssd3 java程序练习 exercise 3 绝对没有问题」· Java 代码 · 共 42 行

JAVA
42
字号
import com.sun.org.apache.bcel.internal.generic.NEW;


public class Product {
	private String code;
	private String description;
	private double price;
	
	public Product() {
		// TODO Auto-generated constructor stub
	}
	
	public Product(String initialCode,
            String initialDescription,
            double initialPrice){
		this.code = initialCode;
		this.description = initialDescription;
		this.price = initialPrice;
	}
	
	public String getCode(){
		return this.code;
	}
	
	public String getDescription(){
		return this.description;
	}
	
	public double getPrice(){
		return this.price;
	}
	
	public boolean equals(Product object){
		return (this.code == object.getCode());
	}
	
	public String toString (){
		return this.getCode()+"_"+this.getDescription()
		+"_"+this.getPrice();
	}
}

⌨️ 快捷键说明

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