- 69 B The Following Code Fragment Shows Some Prototype Code For A Site Hit Counter Which Will Be Deployed As A Javabe 1 (68.14 KiB) Viewed 73 times
[69 (b) The following code fragment shows some prototype code for a site hit counter, which will be deployed as a JavaBe
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
[69 (b) The following code fragment shows some prototype code for a site hit counter, which will be deployed as a JavaBe
[69 (b) The following code fragment shows some prototype code for a site hit counter, which will be deployed as a JavaBean with application scope to count the total number of hits for several different pages. public class Counter { int x 1; public int inc() { return x++; } } Explain why this counter might return an incorrect value when the page is accessed concurrently by more than one client. Describe how the code should be modified in order to prevent this error.