Java : Making a method to sort an array -
i'm trying make method sorting arrays have array made, i'm not sure returning , calling it. please?
public void bubblesort(string words [][] ) { (byte count1 = 0; count1 < words.length - 1; count1++) (byte count2 = 0; count2 < ((words.length)-count1); count2++) { system.out.print(words[count1][count2] + " "); arrays.sort(words); } return words [count1][count2]; }
there no need return array main() functions change in contents of array reflects in array passed during function call in main. in main function following :
intialize 2-d string :
string[][] rows = new string[10][10];
put required array in it.
then call function
bubblesort(rows);
the rows array contains sorted string.
Comments
Post a Comment