Core JAVA Archive

Java Comparable and comparator

In this tutorial, it shows the use of java.lang.Comparable and java.util.Comparator to sort a Java object based on its property value. Java provides some inbuilt methods to sort primitive types array or Wrapper classes array …

Serialization in Java

Serialization in java is a mechanism of writing the state of an object into a byte stream. What is Serialization? – Serializable is a marker interface. When an object has to be transferred over a …

Object Cloning in Java

The object cloning is a way to create exact copy of an object. For this purpose, clone() method of Object class is used to clone an object. The java.lang.Cloneable interface must be implemented by the …