What does the static keyword mean, and where should it be used?
static can be used in 3 ways:
What does synchronized do?
synchronized says that a method has to hold the object’s lock to execute. If used around a block, like synchronized (obj) { … }, it will grab the lock of obj before executing that block.
What is type erasure?
Type erasure is a JVM phenomenon that means that the runtime has no knowledge of the types of generic objects, like List<integer> (the runtime sees all List objects as having the same type, List<object>).</object></integer>
What are the differences between Map, Hashtable, HashMap, TreeMap, ConcurrentHashMap, LinkedHashMap?
What are the differences between interfaces, abstract classes, classes, and instances?
What are the basic interfaces of Java Collections Framework?
Collection is the root of the collection hierarchy. A collection represents a group of objects known as its elements. The Java platform doesn’t provide any direct implementations of this interface.
Set is a collection that cannot contain duplicate elements. This interface models the mathematical set abstraction and is used to represent sets, such as the deck of cards.
List is an ordered collection and can contain duplicate elements. You can access any element from it’s index. List is more like array with dynamic length.
A Map is an object that maps keys to values. A map cannot contain duplicate keys: Each key can map to at most one value.
Some other interfaces are Queue, Dequeue, Iterator, SortedSet, SortedMap and ListIterator.
How do you prevent a class from being subclassed / overridden?
The “final” keyword