Introduction to Java Enum data type with example programs

Introduction to Java Enum data type with example An Enum in Java is a special data type that can be used to define a fixed set of constants. Similar to a class, an enum can contain constants, methods etc. The Java enum constants are implicitly public, static and final. Much like a class, an enum defines a type that can be used to define fields, variables [...]

Read more

Eclipse Shortcut to open method implementation

Eclipse Shortcut: Eclipse shortcut keys are really useful for Java developers. In this article we will see how to set up eclipse shortcut to open method implementation [...]

equals and hashcode in java – When to use?

equals and hashcode method: equals() and hashcode() are two important methods defined in java.lang.Object class. These methods form the base to compare objects for equality, [...]

Exception Handling in Java with examples

Exception Handling Exception handling allows Java applications to handle errors appropriately. Exception handling is a very important yet often neglected aspect of writing [...]

Comparable and Comparator interface in java

Comparable and Comparator: Comparable and Comparator both are interfaces in Java used to sort elements in collection. Difference between comparable and comparator is one of [...]

GSON Example – Convert Java objects to / from JSON

GSON - Java GSON (also known as Google Gson) is an open source Java library used to convert Java objects to (and from) JSON. JSON (JavaScript Object Notation) is a [...]

Strings in Java with examples

Strings in Java: String or more specifically string literal is nothing but a sequence of characters. String is one of the most widely used classes in Java. If you go to any [...]

Lambda expressions in Java

How to use lambda expressions in Java 8? One of the biggest features introduced in Java 8 is the lambda expressions. Lambda expression facilitates functional programming. [...]

Anagram program in java

Write a java program to find if two Strings are anagram.This is one of the most popular interview questions asked in companies like Paypal. What is an Anagram? Two [...]

Shallow copy vs Deep copy in Java

Copying is the duplication of data/information from source object to a destination object. This is done to avoid the time spent in creating the data once again. Most often it [...]