public class Counter extends Object
Counter is a simple counter and a better alternative than Integer as a new instance is created each time you want to set the value.| Modifier and Type | Method and Description |
|---|---|
void |
decrement()
Decrement counter by 1.
|
void |
decrement(int dec)
Decrement counter by
dec. |
boolean |
equals(Object o) |
int |
getCount() |
int |
hashCode() |
void |
increment()
Increment counter by 1.
|
void |
increment(int inc)
Increment counter by
inc. |
void |
reset()
Reset the count to 0
|
String |
toString() |
public void reset()
public void increment()
public void increment(int inc)
inc.public void decrement()
public void decrement(int dec)
dec.public int getCount()
Copyright © 2016. All Rights Reserved.