3. Here is a table named with ‘product’ (Table product (name, type, price)), base on which, construct a java bean named with ‘Product’

解决方案 »

  1.   

    3. Here is a table named with ‘product’ (Table——》product (name, type, price)), base on which, construct a java bean named with ‘Product’.
      

  2.   

    public class Product
    {
        private String name;
        private String type;
        private float price;
        public Product()
        {
        }    public void setName(String name)
        {
            this.name = name;
        }    public void setType(String type)
        {
            this.type = type;
        }    public void setPrice(float price)
        {
            this.price = price;
        }    public String getName()
        {
            return name;
        }    public String getType()
        {
            return type;
        }    public float getPrice()
        {
            return price;
        }
    }
      

  3.   

    public class Product {
        private String name;
        private String type;
        private double price;
        /** Creates a new instance of Product */
        public Product(){
            setName("NoName");
            setType("DefaultType");
            setPrice(0.0);
        }
        
        public Product(String name, String type, double price){
            this.setName(name);
            this.setType(type);
            this.setPrice(price);
        }    public String getName() {
            return name;
        }    public void setName(String name) {
            this.name = name;
        }    public String getType() {
            return type;
        }    public void setType(String type) {
            this.type = type;
        }    public double getPrice() {
            return price;
        }    public void setPrice(double price) {
            this.price = price;
        }
        
    }
      

  4.   

    谢谢大家的帮忙,java里面有statament和preparestatment区别吗??