kCan we serialise the static members
Does not m any sense to make static members serializable
Staic member belong to the class not the individual objects.
Why use the hashmap keys as immutable objects
Since if we use mutable objects as keys at the time of storage and over the time when we change it may point to entire different location.so suppose for key 3 value 33 is associatedif this key is changed then it may point to diffrent location so to avoid this keys are immutable.
Difference save and persist
Save returns serializable entity
Persist return void
WHAt is executerservice
Executerservice is like a threadpool.
It is a way of submit you thread for execution.it is used where asynchronous tasks need to be performed.
Executerservice has submit method.
Which returns future class instance.
Executerservice takes callable instance .
Future returns the result of thread execution
Can we synchronise the constructor
No not possible.since it will be creating lock on object being created but generally the object is not available to other thread till the time it gets created
Can we synchronise the run method
Yes we can synchronize run method.
Types of garbage collection
Parallel gc=serial works same as parallel but the girl is done by multiple threads.
What is difference between notify and notify all
Notify all - will notify all waiting thread
Notify- invokes the first thread which called the wait method on the object
Join() in multithreading
Join method in multithreading is used to pause execution of all other threads except the one which called the join method.
WHY USE INNER CLASSES
inner classes are used to hide implementation details. To increase encapsulation.
Some examples of usage of inner classes are iterator inside list. Listener in gui.