KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > GetSet


1 package test;
2
3 public class GetSet {
4     public static void main(String JavaDoc [] args) {
5         GetSet gs = new GetSet();
6         gs.setValue1(1);
7         gs.setValue2(2);
8         gs.getValue1();
9         gs.getValue2();
10     }
11
12     private int value1;
13     /**
14      * Get method for value
15      * @return Value
16      */

17     public int getValue1() {
18         return this.value1;
19     }
20     /**
21      * Set method for value
22      * @param value
23      */

24     public void setValue1(int value1) {
25         this.value1 = value1;
26     }
27     private int value2;
28     /**
29      * Get method for value2
30      * @return Value2
31      */

32     public int getValue2() {
33         return this.value2;
34     }
35     /**
36      * Set method for value2
37      * @param value2
38      */

39     public void setValue2(int value2) {
40         this.value2 = value2;
41     }
42     
43 }
44
Popular Tags