【正文】
fy a shared object while another thread is in the process of using or updating the objects value. Synchronization prevents such type of data corruption. . Synchronizing a function: public synchronized void Method1 () { // Appropriate methodrelated code. } . Synchronizing a block of code inside a function: public myFunction (){ synchronized (this) { // Synchronized code here. } } Question: What is Collection API? Answer: The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces. Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap. Example of interfaces: Collection, Set, List and Map. Question: Is Iterator a Class or Interface? What is its use? Answer: Iterator is an interface which is used to step through the elements of a Collection. Question: What is similarities/difference between an Abstract class and Interface? Answer: Differences are as follows: Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected p