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