summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/hjp5/examples/Listing0813.java
blob: 9309a46b56e2b59e51548d834408ddcbd701f404 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Listing0813.java */

class SingleValue
{
  protected int value1;

  public SingleValue(int value1)
  {
    this.value1 = value1;
    print();
  }

  public void print()
  {
    System.out.println("value = " + value1);
  }
}

class ValuePair
extends SingleValue
{
  protected int value2;

  public ValuePair(int value1, int value2)
  {
    super(value1);
    this.value2 = value2;
  }

  public void print()
  {
    System.out.println(
      "value = (" + value1 + "," + value2 + ")"
    );
  }
}

public class Listing0813
{
  public static void main(String[] args)
  {
    new ValuePair(10,20);
  }
}