Counter
Keywords: Counter,Counter class

| Package
| Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

## Class Counter

    java.lang.Object
      |
      +--Counter

All Implemented Interfaces:
  java.io.Serializable

public class Counter
extends java.lang.Object
implements java.io.Serializable

Class that implements a simple counter.

See Also:
  Serialized Form

Constructor Summary
`Counter()` Initializes the counter to 1
`Counter(int val)` Initializes the counter to the given value

Method Summary
`void` | `increment()` Increments the counter.
`java.lang.String` | `toString()` Returns string containing value.
`int` | `value()` Gets the value.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Counter

    public Counter()

  Initializes the counter to 1

### Counter

    public Counter(int val)

  Initializes the counter to the given value

Method Detail

### increment

    public void increment()

  Increments the counter.

### value

    public int value()

  Gets the value.

  Returns:
    the value

### toString

    public java.lang.String toString()

  Returns string containing value.

  Overrides:
    `toString` in class `java.lang.Object`

| Package
| Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD