Category Archives: Array Programs in Java

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 »

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 »

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 »

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 »