Java GregorianCalendar | Example Program

GregorianCalendar in Java is a concrete subclass of an abstract class Calender. In other words, it is an implementation of a Calendar class in Java API. It is the most commonly used calendar. A calendar in java is an abstract superclass for obtaining detailed calendar information such as year, month, … Read more

NavigableMap in Java | Methods, Example

NavigableMap in Java is an interface that is a subinterface of SortedMap interface. It extends SortedMap interface to handle the retrieval of entries based on the closet match to a given key or keys. NavigableMap interface was added by Java 1.6 version. It is present in java.util.NavigableMap package. NavigableMap interface … Read more

Java Calendar Class | Methods, Example

Calendar class in Java is an abstract super class that is designed to support different kinds of calendar systems. It is used to know system data and time information. Java Calendar class provides some specific functionality that is common to most calendar systems and makes that functionality available to the … Read more

StringTokenizer in Java | Use, Example

StringTokenizer in Java is a utility class that breaks a string into pieces or multiple strings called “tokens”. For example, strings separated by space and tab characters are tokens. These tokens are separated with the help of a delimiter. A Delimiter is a group of characters that separate tokens. Each … Read more

Comparator in Java | Use, Example

Comparator in Java is an interface whose task is to compare objects of a user-defined class when the class does not implement the Comparable interface. In other words, Java Comparator is used when: Objects to be ordered do not have a natural ordering defined by Comparable interface. You want to … Read more

Comparable Interface in Java | Use, Example

Comparable interface in Java defines compareTo() method for comparing objects of the same type. In other words, Comparable interface defines a standard way in which two objects of the same class will be compared. It is mainly used to provide the natural sorting order of objects (elements). The natural ordering … Read more