KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > a > a2 > B


1 package a.a2;
2
3 import a.a1.IA;
4
5 /**
6  * Example class file.
7  *
8  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
9  * @version $Date: 2003/12/03 22:25:43 $
10  * @since December 2, 2003
11  */

12 public class B implements IA
13 {
14     int value = 0;
15     
16     private class MyInner
17     {
18         public int next()
19         {
20             if (value == -100)
21             {
22                 // should never be exercised in tests.
23
value = -10000;
24             }
25             else
26             {
27                 --value;
28             }
29             return value;
30         }
31     }
32     
33     MyInner inner = new MyInner();
34     
35     public int getNext()
36     {
37         return inner.next();
38     }
39     
40     
41     protected int peek()
42     {
43         // never called in tests.
44
return value;
45     }
46 }
47
Popular Tags