Java : Sort integer array without using Arrays.sort()

后端 未结 12 2596
滥情空心
滥情空心 2021-02-14 00:59

This is the instruction in one of the exercises in our Java class. Before anything else, I would like to say that I \'do my homework\' and I\'m not just being lazy asking someon

12条回答
  •  野性不改
    2021-02-14 01:51

    Array Sorting without using built in functions in java ......just make new File unsing this name -> (ArraySorting.java) ..... Run the Project and Enjoy it !!!!!

        import java.io.*;
        import java.util.Arrays;
        import java.util.Scanner;
        public class ArraySorting 
        {
        public static void main(String args[])
        {
          int temp=0;   
          Scanner user_input=new Scanner(System.in);
           System.out.println("enter Size of Array...");
        int Size=user_input.nextInt();
    
        int[] a=new int[Size];
        System.out.println("Enter element Of an Array...");
        for(int j=0;j a[j] ) 
                 {
                     temp = a[index];
                     a[index] = a[j];
                     a[j] = temp;
                 }
            }
        }
        System.out.print("Output is:- ");
        for(int i=0;i

提交回复
热议问题