Given the following class, what is the value of Logger.logerCount after calling Logger.createInstance(-1) ?
why the output is 1 not zero??
I don't see how this program will print 1 or even zero, you are calling the method with
-1 as an argument which is an exception according to your code. More over you didn't handle or catch the exception, and by the way if you can just put a
System.out.println(loggerCount++) in your finally block then you would see that the value of loggerCount++ is
zero indeed and not 1.