Counts up from 1 to maxValue. After that happens the increment() method returns a 0 to indicate that max value has been reached. MaxCounter counter=new MaxCounter(3); while ((value = counter.increment()) > 0) { System.out.println(value); } When this code is run three values will be printed: 1, 2 and 3
@author Naresh Bhatia
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.