Contains all the java related examples

SimpleDateFormat (Parse Date)

Date conversions are very common scenarios in any application., Java Provides SimpleDateFormat class for String to Date, Date to String conversions. The below example shows How String format can be converted to Date Format. How to find difference between 2 Dates. Code:



BlockingQueue is a thread-safe queue where we can enqueue on one end of queue, and dequeue on another end of queue., All BlockingQueue implementions on array or linked queues are thread-safe implementations. Below is a simple usage of BlockingQueue.



BlockingDeque is an extended implementation of queue where we can enqueue or dequeue on both ends of the queue. All BlockingDeque implementions on array or linked queues are thread-safe implementations. Below is a simple usage of BlockingDeque


Encoding/Decoding In Java

Encoding/Decoding is the method of representing an data, to a different format so that data can be transferred through the network or web. Encoder usually converts the data into web representation and after received in the other end, decoder converts back the web representation data to original data. 1. Base64 Encoding/Decoding Base64 is a way …

Encoding/Decoding In Java Read More »


A Java Class Object needs to serialized if we need to store or transfer with the state values. For any IO operations or network operations usually the java class objects needs to sent/received via network via bytes. During serialization, Object along with state is serialized to bytes and can be processed between the systems as …

Serialization Read More »

Encryption-Decryption (AES)

Encryption is process of encoding meaningful information using mathematical algorithms using a standard key, so that only authorised parties can only decode/decrypt it. Authorised parties usually shares the secret keys each other so that encrypted information can only be decrypted by them.     Plain Text + Key -> Encrypted text     Encrypted Text – Key -> Plain …

Encryption-Decryption (AES) Read More »


Hashtable is an implementation for storing/processing list of objects using a hashkey and buckets. Hashtable has default load capacity of 11, where it will create default 11 buckets if not provided in specific., and stores the list of objects in the buckets based on the object hashkey. Any object/value inserted into Hashtable object, will be …

Hashtable Read More »


Map is another important key interface in Java present in java.util package. Map contains list of objects associated with a key., for quick retrieval.Each Key is tied to one object i.e., every Object has its own unique key. Since Map stores object values based on keys, it dont maintain any order. Add/Retrieval/Search operations can be …

java.util.Map Read More »


Set is another important Datastructure created in Java, just like List.Set is same as List, except it dont contain duplicates, and dont maintain order. As you remember, List can have duplicates & also maintains internal Order. Set Types: Below are the most used implementation classes of Set Interface. HashSet – HashTable implementation of Set Interface. …

java.util.Set Read More »