## Java program to remove consonants from a string

Let’s learn java program to remove consonants from a string. Java program to remove consonants from a string Here’s the program to remove consonants from a string. For example, Input string: hello world core java Output string: eo o oe aa Input string: flower brackets Output string: oe ae import java.util.Arrays; import java.util.List; public class…

Read More Java program to remove consonants from a string

## gcd of two numbers in java

Let’s learn to find gcd of two numbers in java. gcd of two numbers in java GCD of two numbers is the largest positive number that divides both numbers without remainder. For example: GCD of 12 and 16 is 4 To find GCD of two numbers an efficient solution is to use Euclidean algorithm. Let’s…

Read More gcd of two numbers in java

## Find GCD of three numbers in java

Let’s learn to find GCD of three numbers in java. Find GCD of three numbers in java GCD is largest positive integer that can exactly divide each one of the number. Here’s an example on gcd of three numbers in java. import java.util.Scanner; public class GCDOfThreeNumbers { public static void main(String[] args) { Scanner sc…

Read More Find GCD of three numbers in java

## Java program to print armstrong numbers between given range

Let’s learn java program to print armstrong numbers between given range. Java program to print armstrong numbers between given range In the below program to print armstrong numbers between given range first user inputs given range, that is, starting number and ending number using nextInt() method of Scanner class. Finally print armstrong numbers between given…

Read More Java program to print armstrong numbers between given range

## Java program to calculate sum of even and odd numbers in an array

Let’s learn java program to calculate sum of even and odd numbers in an array. Java program to calculate sum of even and odd numbers in an array In the below java program first user enters number of elements in an array or size of an array and also array elements using nextInt() method of…

Read More Java program to calculate sum of even and odd numbers in an array

## Java program to print odd and even numbers between 1 and 100

Let’s learn java program to print odd and even numbers between 1 and 100. Java program to print odd and even numbers between 1 and 100 In the below program to print odd and even numbers between 1 and 100 we are using two for loops. One to print even numbers and another to print…

Read More Java program to print odd and even numbers between 1 and 100

## count number of even and odd elements in an array in java

Let’s learn to count number of even and odd elements in an array in java. count number of even and odd elements in an array in java To count the even and odd numbers in an array first user is allowed to enter size and elements of one dimensional array using nextInt() method of Scanner…

Read More count number of even and odd elements in an array in java

## Java program to put even & odd elements of an array in 2 separate arrays

Let’s learn java program to put even & odd elements of an array in 2 separate arrays. Java program to put even & odd elements of an array in 2 separate arrays In the below program to put even & odd elements of an array in 2 separate arrays first user is allowed to enter…

Read More Java program to put even & odd elements of an array in 2 separate arrays

## How to remove last element from arraylist in java

Let’s learn how to remove last element from arraylist in java. How to remove last element from arraylist in java To remove last element from arraylist use two overloaded remove() method of ArrayList. They are, remove(int index): accepts the index of the element to be removed. Pass index of last element to delete last element.…

Read More How to remove last element from arraylist in java

## Java program to find maximum and minimum number without using array

Let’s learn java program to find maximum and minimum number without using array. Java program to find maximum and minimum number without using array In the below example we are using Integer.MAX_VALUE and Integer.MIN_VALUE to find maximum value and minimum number without using array. Here’s the java program. import java.util.Scanner; public class MaximumMinimumWithoutArray { public…

Read More Java program to find maximum and minimum number without using array