// import Counters.WarningCounter; import Counters.CounterException; public class ExceptionDemo { public static void main( String argv[]) { WarningCounter demoCounter = new WarningCounter( 10, 12); System.out.println( "\n\t\t Warning Counter demonstration \n"); try { System.out.print( "it is 10 ... "); System.out.println( demoCounter.numberCountedIs()); System.out.print( "unCount before any count, exception ... "); demoCounter.unCount(); System.out.print( "it should be 9 ... shouldn't occur"); System.out.println( demoCounter.numberCountedIs()); } catch (CounterException e){ System.out.println("warning message");}; } // End main } // End ExceptionDemo