#2
The Java ClassLoader system, and protecting sensitive classes.
The ClassLoader mechanism is responsible for loading and verifying java bytecode and using it to instantiate Class instances within the JVM. The ClassLoader is asked to retreive a class the first time it is referenced. There is one system ClassLoader which is used by default, and additional ClassLoaders can be set as the default per-thread. Any mechanism can be used to retrieve the given code, up to and including dynamically generating it on the fly (this is how scripting languages are implemented atop the JVM).
By first delegating requests up to the parent ClassLoader, and only handling them in the cases where the parent (system) ClassLoader does not locate the class, you are protected from loading overriding sensitive system classes which may have not been loaded yet. You could even just implement your own strategy in your ClassLoader to white-list a particular package, or only handle classes implementing a specific set of interfaces.
Finally a security policy can be used to restrict which code is even allowed to change the ClassLoaders in use.
#3
Can an interface define inner classes?
Absolutely!
It comes in handy if you want to provide an Enum in the definition of your interface. Though I don't know any real cases where this provides a clear benefit, since there's no special access to a class instance that you'd normally get with inner classes within classes.
You can also define fields (must be final, but can non static!). Anyone know why you would ever use this? And does the implementing class inherit them as expected?
#4
Causes of deadlocks
There are two common situations.
Two threads which attempt to acquire a series of locks in different orders can end up each holding a lock which the other is waiting for.
Code which attempts to acquire a lock it already holds (usually due to recursion). For this you should consider switching using java.util.concurrent.Lock. the ReentrantLock implementation solves this problem elegantly.