Tag Archives: Java interview question

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 »

Why do we have to override the equals() method in Java?

Why do we have to override the equals() method in Java?

Why do we have to override the equals() method in Java? We can use the equals method to check equality of two objects. The equals() method of java.lang.Object class acts the same as the == operator; that is, it tests for object identity rather than object equality. The implicit contract of the equals() method, however, is that it tests for equality rather than identity. Thus most ...

Read More »

What is the meaning of hashCode in Java?

What is the meaning of hashCode in Java?

What is the meaning of hashCode in Java? For every object a unique number generated by JVM which is nothing but hashCode. Hashcode won’t represent an address of the object. JVM will use hashCode while saving the object into hashing related data structures like HashTable, HashSet, HashSet, etc.. The main advantage of saving object based on HashCode is search operation ...

Read More »

What is Daemon thread and How to make Daemon thread?

What is Daemon thread and How to make Daemon thread?

What is Daemon thread and How to make Daemon thread? The threads which are executing in the background are called Demon threads. Ex… Garbage Collector, Signal Dispatcher, Attach Listener. The main objective of demon threads is to provide support for non-demon threads(main thread) For ex… If the main thread runs with low memory then JVM runs GC to destroy useless ...

Read More »

What is synchronization and why it is important?

What is synchronization and why is it important?

What is synchronization and why it is important? Synchronized is the modifier applicable only for methods and blocks but not for classes and variables. If multiple threads are trying to operate simultaneously on the same java object then there may be a chance of data-inconsistency problem. To overcome this problem we should go for the synchronized keyword. If a method or block declared as ...

Read More »

What is Transient Keyword in Java?

What is Transient Keyword in Java?

What is Transient Keyword in Java? Transient modifier applicable only for variables but not for methods and classes. We can use a transient keyword in serialization context. At the time of serialization if we don’t want to save a value of a particular variable to meet security constraint then we should declare that variable as transient. At the time of ...

Read More »

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