This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The following code is inside a method. What does TThread94.class means in the code. Is it an Object or a Class? I think it is trying to synchronized against the TThread94 Class and using it to notifyAll()? It is a compile error if I just used TThread.notifyAll(), complaining non-static method notifyAll() cannot be referenced from a static context.
You guessed it right. I believe that the class TThread94 has some static method that's synchronized, and there are competing threads to access it. So to notify those threads, the Class "object" of TThread94 must be used, as notifiyAll() is an instance (and not static) method of class Object. That's the reason you got a compilation error when you try to invoke TThread94.notifyAll(). TThread94.class returns the class object that is created when the class TThread94 is loaded.
As Java has both class Class and class Object and because class and object are also the most frequently used terms in the language, it's kind of difficult to explain a scenario such as this with unambiguous language