Tag Archives: Core java interview

What is WeakHashMap in Java?

What is WeakHashMap in Java?

  What is WeakHashMap in Java? It is exactly same as HashMap except for the following difference:- In the case of HashMap even though object doesn’t have any reference it is not eligible for GC. If it is associated with HashMap that is HashMap dominates Garbage collector. But in the case of WeakHashMap, if the object doesn’t contain any references ...

Read More »

What is IdentityHashMap?

What is IdentityHashMap?

What is IdentityHashMap? In journal == operator meant for reference comparison (address comparison) and equals() method meant for content comparison. It is exactly same as HashMap(including methods and constructors) except the following difference. In the case of normal HashMap, JVM will use .equals() method to identify duplicates keys, which is meant for content comparison. But in the case of identity HashMap JVM will ...

Read More »

Comparison table of SET Implemented classes?

Comparison table of SET Implemented classes?

Java Set is a collection of elements (Or objects) that contains no duplicate elements. Java Set is an interface that extends Collection interface. Unlike List, Java Set is NOT an ordered collection, it’s elements does NOT have a particular order. Java Set does NOT provide a control over the position where you can insert an element. You cannot access elements by their ...

Read More »

Explain ArrayList and difference between ArrayList and Vector?

Explain ArrayList and difference between ArrayList and Vector?

Explain ArrayList and difference between ArrayList and Vector? ArrayList is a class, that uses a dynamic array for storing the elements. It extends AbstractList class and implements List interface. The underlying data structure is a Resizable array or growable array. Duplicates are allowed. Insertion order is preserved. Heterogeneous objects are allowed(except TreeSet and TreeMap everywhere Heterogeneous objects are allowed) Null ...

Read More »

How many ways can we make an object eligible for GC?

How many ways can we make an object eligible for GC?

How many ways can we make an object eligible for GC? Even through programmer is not responsible to destroy useless objects it is highly recommended to make an object eligible for GC. If it no longer a requirement. The garbage collector will look for objects which aren’t being used anymore and gets rid of them, freeing up the memory so ...

Read More »

Difference between yield(), join(), sleep() method?

Difference between yield(), join(), sleep() method?

Difference between yield(), join(), sleep() method? We can prevent thread execution by using the following method. yield() join() sleep() public static native void yield()  yield() method causes to pause current executing thread to give the chance for waiting threads of the same priority. If there is no waiting thread or all waiting threads have low priority then the same thread ...

Read More »

Responsive WordPress Theme Freetheme wordpress magazine responsive freetheme wordpress news responsive freeWORDPRESS PLUGIN PREMIUM FREEDownload theme free