Still getting time limit error in one test case

I have created an array of objects of class and then sorted them accordingly but I am still getting TLE error.
import java.util.*;
public class a {
static class Employee{
int salary;
String name;
Employee(String nam,int sal)
{
salary=sal;name=nam;
}
void display()
{
System.out.println(name+" "+salary);
}
}
public static void main(String args[]) {
// Your Code Here
Scanner obj = new Scanner(System.in);
int x = obj.nextInt();
int n = obj.nextInt();
Employee list[]=new Employee[n];
for (int i = 0; i < n; i++) {
list[i]=new Employee(obj.next(),obj.nextInt());
}
// Arrays.sort(list);
for (int i = 0; i < n - 1; i++)
for (int j = 0; j < n - 1 - i; j++) {
if (list[j].salary < list[j + 1].salary
|| (list[j].salary == list[j + 1].salary && list[j].name.compareTo(list[j + 1].name) > 0)) {
Employee temp;
temp = list[j];
list[j] = list[j + 1];
list[j + 1] = temp;
}
}
for (int i = 0; i < n; i++) {
if(list[i].salary>=x)
list[i].display();

    }


}

}

Hi @Anupreet9,dont use bubble sort here,use merge sort or quick sort as it has less time complexity.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.