public class Product { private int spID; private String spName; private double spPrice; private int spDesc; private String spKucun; private String spTime;

public Product(int spID, String spName, double spPrice, int spDesc, String spKucun, String spTime) {
    this.spID = spID;
    this.spName = spName;
    this.spPrice = spPrice;
    this.spDesc = spDesc;
    this.spKucun = spKucun;
    this.spTime = spTime;
}

public String getInfo() {
    return '商品ID:' + spID +
           '

商品名称:' + spName + ' 商品价格:' + spPrice + ' 商品描述:' + spDesc + ' 商品库存:' + spKucun + ' 商品上架时间:' + spTime; }

Java 面向对象编程:商品信息类实现

原文地址: https://www.cveoy.top/t/topic/oTQP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录