Yurttas/PL/OOL/Java/F/02/01/06/A.java

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 1998
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 1998.
11 *  @author : Salih Yurttas.
12 */
13
14
15public class A {
16
17  public int i0;
18  protected int i1;
19  private int i2;
20
21  public A() {
22    i0 = 2;
23    i1 = 2;
24    i2 = 2;
25  }
26
27  public A(final int i) {
28    i0 = i;
29    i1 = i;
30    i2 = i;
31  }
32
33  public A(final int i,
34           final int j,
35           final int k) {
36    i0 = i;
37    i1 = j;
38    i2 = k;
39  }
40
41  public int geti1() {
42    return i1;
43  }
44
45  public int geti2() {
46    return i2;
47  }
48
49  public int[] geti12() {
50    int[] a = new int[2];
51
52    a[0] = i1;
53    a[1] = i2;
54
55    return a;
56  }
57
58  public int[] geti012() {
59    int[] a = new int[3];
60
61    a[0] = i0;
62    a[1] = i1;
63    a[2] = i2;
64
65    return a;
66  }
67
68  public void seti1(final int i) {
69    i1 = i;
70  }
71
72  public void seti2(final int i) {
73    i2 = i;
74  }
75
76  public void seti12(final int i) {
77    i1 = i;
78    i2 = i;
79  }
80
81  public void seti12(final int i,
82                     final int j) {
83    i1 = i;
84    i2 = j;
85  }
86
87  public void seti12(final int[] a) {
88    i1 = a[0];
89    i2 = a[1];
90  }
91
92  public void outi012() {
93    System.out.println("i0 = " + i0);
94    System.out.println("i1 = " + i1);
95    System.out.println("i2 = " + i2);
96  }
97
98}