this code is little modified from original one.
ouput:10 10 2 ok fine.
but if at line1 we remove static,then it shows size=0 why?
i am lacking somewhere?
since at line1 Map is declared static its no more different for different instances.
So all the instances of BookStore will share this and any changes made by anyone of them will be reflected by the others.
Now, when you remove 'static' at line 1, you are making Map an instance variable and so each instance of BookStore will have its own copy of map.
At line 2, you are making a new instance of BookStore which has its own copy of Map and this Map doesn't have anything so it returns the size '0'.