Okay so here's what I have so far:
Scanner key = new Scanner (System.in);
String[] main = new String[10];
for(int k = 0; k< main.length; k++)
{
System.out.println("Enter a lower case letter! ");
main[k] = key.nextLine();
}
for(int z = 1; z < 11; z++)
{
char[] array = main[z-1].toCharArray();
System.out.println(array);
}
for(char c : array)
{
System.out.println(c);
}
However, I have not found a way to print it, I think the char array is set up correctly, but I have little knowledge of how char arrays work. Also, it is worth noting that I cannot use Arrays.sort
; however, I can use String.compareTo
. I am trying to get a string array like a,j,d,f,h,y,d,a,d,g to print it out in alphabetical order without using Arrays.sort
.