Card image cap
Simple Java Program to explain constructors in Java

We know that all objects that are created must be given initial values. We can do this by two approaches. The first approach uses the dot operator to access the instance variables and then assigns value to them individually. But it can be a tedious approach to initialize all the variables of all the objects individually.

Card image cap
Java Program to Calculate the Frequency of the Strings using HashMap

Java program to calculate the frequency of the string using HashMap is given below. In this program we first created a HashMap wherer string is the key and its number of occurrence is value.

Card image cap
Java Program to traverse a Graph using BFS (Breadth First Search)

Breadth First Search (BFS) algorithm is used to traverse a graph in a breadthward motion. BFS Algorithm use data structure queue to remember to get the next vertex to start the search and we will requred an array to keep the track of vertex that it is visited or unvisited.

Card image cap
How to send email using JavaMail API | JAVA

First of all you have to setup environment to send a mail using JavaMail API. You have to download some jar files and them to the CLASSPATH. steps are given below.

Card image cap
Copy Constructor in Java

Unlike C++, Java doesn't support default copy constructor, But you can write your own copy constructor in Java. Java program to explain the copy constructor is given below.

Card image cap
Different ways to Print Exception Messages | Java

There are three methods available in Java to print the exception messages. Those three methods are the member of Throwable class. These three methods can be used to print the exception message for any exception object because Throwable class is the base class for all exceptions.

Card image cap
Java Program to check If a String is Palindrome or not

A palindrome String is a word, phrase, number, or others sequence of characters which reads the same backward or forward, such as madam or kayak.