
create a program where you will input 10 numbers and arrange it in ascending way using arrays.

Java Input array elements and arrange them in ascending order
import java.util.*;
class ArraySort{
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Enter Array Elements: ");
int array[]=new int[10];
for(int i=0;i<array.length;i++){
array[i]=input.nextInt();
}
System.out.println("Sorted Array:");
Arrays.sort(array);
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
}

it didnt work,, it only copy the input numbers and does not in arrange it in ascending way...

it did work... I modified the line:
System.out.println(array[i]);
into
System.out.print(array[i]) + " "); so it prints in one line... that way I can see the sorted array better
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.