
Singleton class is a class whose only one instance can be created at any given time in one JVM. Make constructor as private, so that instance cannot be created outside the class. Private static instance needs to be created in that class itself. Static method should created a new instance if the value is null.

Declare the class as a final so it can’t be extended. Make all fields private so that direct access will be avoided. Do not implement setter methods for a variables. Make all mutable fields final so that it’s value can be assigned only once. Perform cloning of objects in getter methods for returning the copy

The difference being that JMS messages have some standard header fields at the begining of the message buffer and “native” mq messages contain just the data your program sent to the buffer. Performance is not the only reason to send plain messages (MQ format) without the JMS Headers from JMS Client to MQ Server. AMQP (Advance Message Queuing Protocol) The Advanced Message Queuing Protocol (AMQP) is an open standard for

Java Messaging Service is an api that provides the facility to create and send the messages. JMS makes easy to develop enterprise applications that asynchronously send and receive business data and events. It defines a common enterprise messaging API that is designed to be easily and efficiently supported by a wide range of enterprise messaging

In HashMap, only one null key is allowed. If key of the HashMap is null then it will always be present in the index 0. NullPointerException is thrown if you try to call hashCode() method on null key.As a result, when a get() method is called then value of the first index is returned.

Yes. We can use any class as a Map key, however the following points should be considered before using them. If a class overrides an equals() method, it should also overrides hashCode() method. Best practice for user defined key class is to make immutable, so that the hashcode value can be cached for fast performance.

HashMap uses the key object hashCode() and equals methods to determine the index to put the key-value pair. The methods are also used when we try to get the value from HashMap. If these methods are not implemented correctly, two different keys might produce the same hasCode() and equals() output and in that case, rather

Hashmap stores a key-value pair in Map.Entry static nested class implementation. HashMap works on hashing algorithm and uses hashcode() and equals() method in put() and get() methods. When we call put() method by passing key-value pair, HashMap uses key hashcode() with a hashing to find out the index to store the key-value pair. The entry

Enum is a java keyword, we can use it for a variable to be set of predefined constant value. Before Java 1.5 we used public static final keywords to represent constants. Enum was introduced in Java 1.5 and since then we use it represent constants or string name for a variable. Also Enums are thread