# Archives: Logical Programs

## Check whether a character is a Vowel or Consonant

In this program, you will learn to check whether a character is a Vowel or Consonant in Java. The vowels are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’, and all remaining characters from the alphabet are consonants. Let’s see a few java program examples of it below: Example-1. Find if a character is a Vowel or …

## Java Program to Check Whether a Number is Even or Odd

In this program, you will learn to check whether a number is Even or Odd in Java. To understand this program you should have basic knowledge of if…else statements and ternary operators in java. Here, we use a java.lang.Scanner object to read a number from the user’s keyboard. The entered number is then stored in a variable …

## Sum of Two Arrays in Java

In this article, you will see the Sum of two arrays in Java. Here, we will take two integer arrays and store the sum of both arrays into a 3rd integer array. Example#1. Sum of two arrays in Java OUTPUT: 7 10 7 7 13 21 Example#2. Addition of two arrays in Java using Scanner …

## Find Average of Odd and Even Numbers in Array Java

In this article, you will see how to find the Average of Odd and Even numbers in an Array using Java. To understand this program, you should have the basic knowledge of an integer array and the looping concept. Even Number: Any number that can be exactly divided by 2 is called an even number.Odd Number: …

## Find the Sum of Even Numbers in an Array in Java

In this article, you will learn how to find the Sum of even numbers in an Array using Java. Here, we first check whether an array element is an Even number or not by dividing it by 2. If the remainder is 0 then the number is an Even number. We will add all found …

## Java Program to print Odd and Even numbers from an Array

In this article, you will learn how to Print Odd and Even numbers from an Array in Java. We can find odd and even numbers in an array using a java program by getting the remainder of each element and checking if it is divisible by 2 or not. If it is divisible by 2, then …

## Java Program to find Second Largest Number in an Array

In this article, you will see how to find Second largest number in an Array using Java. To understand this program, you should have the basic knowledge of an integer array and the looping concept. Let’s see a few examples here, Example #1. Find the 2nd largest number in the array using java In this …

## Java Program to Merge Two Arrays

In this article, you will learn the Java program to merge two arrays. Merging two arrays means combining both array elements into a single array. In order to merge two arrays, we will iterate both arrays one after the other and copy all the elements into the third array. Let’s see a few examples below: Example#1. …

## Java program to Copy an Array

In this article, you will learn the Java program to copy an array. To copy an array we just use a for loop and copy the array element into another array. Example#1. Copy the array to another array OUTPUT: Copied array elements:2 4 3 8 10 0 7 15 Example#2. Copy the array to another …

## Java program to remove duplicate elements in an Array

In this article, you will learn Java program to remove duplicate elements in an Array. Here, you will see total 4 approaches to do this program using Java. To understand first three approach, you should have basic understanding of integer array and looping concept. And for the last approach you should have the java collection …