Structure of the Problem Requirements
Java language facilitate its developers with many builtin function. When we deal with arrays in Java then there are many function and array sorting is one of them. This function sort integers in ascending order . You just declare the array class in your package and use this function.
Source Code
package com.ancodingpoint.www;
import java.util.Arrays;
import java.util.Scanner;
public class Arrays_sorting{
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int numbers[] = new int [5];
for (int i=0; i<5; i++)
{
System.out.println(" Enter Your Number ");
numbers[i] = input.nextInt();
}
System.out.println(" Number After Sorting ");
for (int i=0; i<5;i++)
{
Arrays.sort(numbers);
System.out.println(numbers[i]);
}
}
}
Output of the Program
Java Sorted Array |
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
0 comments:
Post a Comment