example
Class Incrementer
java.lang.Object
example.Incrementer
public class Incrementer
- extends Object
A very simple class to test
- Author:
- vesal
Constructor Summary |
Incrementer()
Initialize the incrementer |
Method Summary |
int |
getCount()
|
void |
inc()
Increment the value by one |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Incrementer
public Incrementer()
- Initialize the incrementer
- Example:
Incrementer inc = new Incrementer(); inc.getCount() === 0;
// this does not generate code,
Incrementer inc = new Incrementer();
inc.getCount() === 0;
inc
public void inc()
- Increment the value by one
- Example:
Incrementer inc = new Incrementer();
inc.inc(); inc.getCount() === 1;
inc.inc(); inc.getCount() === 2;
inc.inc(); inc.getCount() === 3;
getCount
public int getCount()
- Returns:
- current value
- Example:
Incrementer inc = new Incrementer(); inc.getCount() === 0;
// this must be on itse own line