Shopping for code in the digital aisles

Report a typo

You're building an online shop system. Fill the blanks in the code to create a Product class inside a package named com.myshop.products. The class should have an ID, name, and price, with a constructor to set these values.

Fill in the gaps with the relevant elements
 com.myshop.products;
  Product {
     int id;
    private String name;
    private double price;
    public Product(int id, String name, double price) {
        this.id = id; this.name = name; this.price = price;
    }
}

Create a free account to access the full topic