Why do you create interfaces, and when MUST you use one?
You would create interfaces when you have two or more functionalities talking to each other. Doing it this way help you in creating a protocol between the parties involved.
interfaces are only declarations , for that can change our functionaly with greate extent
How to make application thread-safe ?
You should use the word synchronized to mark the critical section of code. You may also use other methods of thread synchronization (see wait(), notify(), notifyAll() etc.
Can an exception be rethrown?
Yes, an exception can be rethrown.
What are wrapped classes?
Wrapped classes are classes that allow primitive types to be accessed as objects.
Can a lock be acquired on a class?
Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
The synchronized keyword tells the JVM that the method requires a lock in order to run. The JVM then creates the lock and manages the allocation of the lock to threads during execution. When a thread has the lock for a class, it is the only thread that can execute any of the class methods that require a lock