Let’s learn how do you arrange words in a sentence in alphabetical order in java? Arrange words of a sentence in alphabetical order in java In the below example we are using collection to arrange words of a sentence in alphabetical order. Here’s the program to arrange words of a sentence in alphabetical order in…

Read More Arrange words of a sentence in alphabetical order in java

Let’s learn java program to find largest of four numbers using nested if. Java program to find largest of four numbers using nested if In below java program first user is asked to enter four numbers one by one using nextInt() method of Scanner class. These four numbers are stored in four integer variables number1,…

Read More Java program to find largest of four numbers using nested if

Let’s learn java program to find smallest of three numbers using ternary operator. Java program to find smallest of three numbers using ternary operator In the below program we are using two ternary operators to find the smallest of three numbers. Ternary operator in java comprises of a condition which evaluates to either true or…

Read More Java program to find smallest of three numbers using ternary operator

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

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

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

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

Let’s learn how 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…

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