|
|
Q.1 What is the difference between an Interface and an Abstract class? Modify answer Delete (after enough votes question will be removed)
An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.
Q.2 Describe synchronization in respect to multithreading. Modify answer Delete (after enough votes question will be removed)
With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.
Q.3 What is final? Modify answer Delete (after enough votes question will be removed)
A final class can't be extended ie., final class may not be subclassed. A final method can't be overridden when its class is inherited. You can't change value of a final variable (is a constant).
|