, . , :
public class B{
public static void MichaelBubbleSort(Person[] arr){
Person temp;
for(int i=0; i < arr.length-1; i++){
for(int j=1; j < arr.length-i; j++){
if(arr[j-1].score > arr[j].score){
temp=arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
}
public static void main(String x[]){
Person [] a={new Person("John","Doe",75),new Person("Joe","Blow",65),new Person("Mary","Smith",80),new Person("John","Green", 82),new Person("Jill","White", 97)};
MichaelBubbleSort(a);
for(Person i:a){
System.out.println(i.FirstName+" "+i.LastName+" "+i.score);
}
}
}
class Person{
int score;
String FirstName;
String LastName;
Person(String FName,String LName,int Score){
this.score=Score;
this.FirstName=FName;
this.LastName=LName;
}
}