## Find Length of String Without Using length() Method in Java

In interviews some time people are ask to write a Java program to find string length without using length() method of the String class. There are a couple of ways to find the length of the String with out using length method in Java. You can convert the passed string…

## How to Reverse a Number in Java

In this post we’ll see how to reverse a number in Java. The Java program to reverse a number can be written in both iterative as well as recursive way. Both solutions are given here. Logic for both of the method is similar; you need to do a modulo division…

## How to Reverse a String in Java

In this post we’ll see how to reverse a string in Java. Though StringBuffer and StringBuilder classes in Java have a reverse() method that can be used to reverse a String but you may be asked to write your own logic to reverse a String. In that case too you…

## Check Given Number Palindrome or Not in Java

In this post we’ll see how to write a Java program to check whether a given number is palindrome or not. A number is said to be a palindrome if it remains same when reversed as example 1221, 1001. Java program – Given number is palindrome or not In order…

## Check Given String Palindrome or Not in Java

In this post we’ll see how to write a Java program to check whether a given string is palindrome or not. A string is said to be a palindrome if it remains same when reversed as example mom, malayalam. Given String Palindrome or not – Java program In order to…

## Matrix Multiplication Java Program

This post shows a Java program to multiply two matrices. To multiply one matrix with another you need to do a dot product of rows and columns. Let’s see it with an example where you are trying to multiply a 3X3 matrix with a 3X2 matrix. How matrix multiplication happens…

## Java Program to Count Number of Words in a String

In this post we’ll see Java program to count number of words in a String. You can use split() method provided by the Java String class with the regular expression “\\s+” to match any number of white spaces. split() method returns an array which contains each substring of this string…

## Java Program to Count The Frequency of Each Character in a String

In this post we’ll see a Java program to count the frequency of each character in a string. Here two ways of counting the number of times each character appears in a String are given. Using HashMap where character is the key and count is the value. For every character…