I see mostly questions pertaining to mostly front end work. Can you guys help me with a Java question?
Having trouble learning this. I am trying to create an array. The program needs to take in the user data and then sort them. I do not want to use arrays.sort; Can someone help me? My code is listed below. Also, is ther
import java.util.Scanner;
public class Sorter
{
public static void main(String[]args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter desired numbers");
int[] spaceship = {0,0,0};
int[] sortedSpaceship = {0,0,0};
int i = 0;
int copy = 0;
while (i < 3)
{
spaceship[i] = sc.nextInt();
i++;
}
i = 0;
while ( i < spaceship.length )
{
System.out.println(spaceship[i]);
if ( i == 0)
{
sortedSpaceship[i] = spaceship[i];
}
else
{
}
if ( spaceship[i] < sortedSpaceship[i])
{
}
// copy = spaceship[i];
//
// spaceship[i] = spaceship[i+1];
//
// spaceship[i + 1] = copy;
i++;
}
}
}