When I run the following code which I got from Head First Java (it uses Java 5.0, by the way), I get the following error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Accum.getAccum
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
Here is the code:
Can anybody help me with this problem? I have marked the problem lines, by the way.
No idea. After fixing those two catch errors the code compiles just fine on my system (Windows 7, JDK 1.6.0_25). The results are random though, but that makes sense since there is no synchronization on the updating of the counter.