01 /*
02 *
03 * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
04 *
05 */
06 package demo.inventory;
07
08 public class Product {
09 private double price;
10 private final String name;
11 private final String sku;
12
13 public Product(String n, double p, String s) {
14 name = n;
15 price = p;
16 sku = s;
17 }
18
19 public int hashCode() {
20 return sku.hashCode();
21 }
22
23 public final String getName() {
24 return name;
25 }
26
27 public final String getSKU() {
28 return sku;
29 }
30
31 public synchronized void setPrice(double p) {
32 price = p;
33 }
34
35 public synchronized double getPrice() {
36 return price;
37 }
38 }
|