# Category Archives: Array Programs in Java

## Mark Even and Odd Numbers in Java Array

Task: Write a Java Program To Mark Even and Odd Numbers in Array. First of all the user will enter the size of the array for example 10 or 20 etc. The program will ask the user to enter n numbers according to the given size of the array. The user will enter n numbers… Read More »

203 total views,  5 views today

## Find Second Largest Number in Java Array

Task: Write a Program to Find Second Largest Number in Java Array. Do not use sorting. Use only one loop. Java Source Code To Find Second Largest Number in Java Array /* * Write a Java program to find second largest in an array with only ONE LOOP, that is without sorting. */ package secondlargest;… Read More »

183 total views

## Java Array Program Implement Linear Search Algorithm

Task: Write a Java Array Program Implement Linear Search Algorithm. Input 10 numbers in array. Input a number to search in the array. Find index of this item in array of 10 integers. The source code for Linear Search program using array in Java programming Language: /* * Write a Java program to Search an… Read More »

116 total views,  1 views today

## Java Array Program to Find Sum of Even Numbers in Array

Task: Write a Java Array Program to Find Sum of Even Numbers in Array. This Java program uses a simple mathematical logic to check whether an array item ( that is number ) is even. The idea is to divide a number by two and obtain remainder. If remainder is a zero then the given… Read More »

248 total views,  2 views today

## Java Array Program to Print Odd Numbers in Array

Task: Write a Java Array Program to Print Odd Numbers in Array. This Java Array program uses simple logic to check whether number is odd. It will divide a number with 2 and get remainder of division using % arithmetic operator. Therefore, if the remainder is a 1, the number will be odd. The Source… Read More »

139 total views,  1 views today

## Print List of Even Numbers in Java Array

Task: write a Java Array Program to Print List of Even Numbers in array. This Java program is written using: Java array – Declare array of 10 integer numbers. for loop – To input numbers in array and accessing these numbers. if statement in Java – To check a number for Even number. Source Code… Read More »

353 total views,  1 views today

## Find Sum and Average of Array in Java

Task: Write a Java program to Find Sum and Average of Array in Java. First of all, the user will input 5 numbers of type double in array. After this, the Java program will calculate sum and average of the numbers in array. The source code of Java Program to find Sum and average of… Read More »

390 total views,  3 views today

## Java Arrays sort in Descending order

Task: How to use Java Arrays sort method for Descending order. How To Use Arrays.sort() method to Sort Arrays in Descending Order? In a previous post, we wrote a Java program to sort array in ascending order using Arrays.sort(array-name) method. We can use the following syntax to sort in descending order: Arrays.sort(array, Collections.reverseOrder()); Here we… Read More »

321 total views,  1 views today

## Java Arrays sort Method to Sort Arrays

Task: Write a Java Program to use Java Arrays sort Method to Sort Arrays in Ascending Order. Use arrays containing of different types of data that is arrays of integers, arrays of doubles or arrays of strings strings etc. What is Java Arrays sort Method? Actually there is a class in java.util package known as… Read More »

179 total views

## Java Program For Input Numbers in Array

Task: Java Program For Input Numbers in Array and display them. The source code for  Java program to declare and enter numbers in array, and display them using for loop /* * Write a Java program to declare one dimentionalarray of 10 integers. Input numbers using for loop and display them. */ package inputnumbersarray; import… Read More »

917 total views,  6 views today