I am bit confused with some implementation,Here is the my problem,
- Two users can login to the system.(User A,B)
- They login same time with different user names and passwords
We assume, Employee class has a static variable call age
User A change the age value to 45, after that user B change the age value to 28, then both save the changes.
so what would be the real values of A and B?
Thank you
Well, first of all, “age” should be an instance variable, not static – a static variable is shared by all the instances of a class.
In the example you gave, the last set value is the one “which sticks”, assuming you are working in a non clustered environment (ie, shatic variables are shared in classes instantiated in the same virtual machine).