Can u correct my compare class

hi @abhay_091
i have made few changes to your code please have a look and if you have a doubt feel free to ask

package ChallengeFundamentalPattern;
import java.util.Comparator;
import java.util.Arrays;
import java.util.Scanner;

class Employee
{
String name;
public Employee(String name)
{
this.name = name;
}
}

class Checker1 implements Comparator
{

  @Override

public int compare(Employee a,Employee b)
{
int i = 0;
String s1=a.name;
String s2=b.name;

    while (i < s1.length() && i < s2.length()) {

        if (s1.charAt(i) > s2.charAt(i)) {

            return 1;
        } else if (s1.charAt(i) < s2.charAt(i)) {
            return -1;
        }
        i++;

    }

    if (s1.length() > s2.length()) {
        return -1;
    } else {
        return 1;
    }

}    

}

public class StringSort1 {

public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int n;
	n=sc.nextInt();
	Employee[] employee=new Employee[n];
	Checker1 checker = new Checker1();
	for(int i = 0; i < n; i++)
	{
		employee[i] = new Employee(sc.next());
    }
    Arrays.sort(employee, checker);
    for(int i = 0; i < employee.length; i++)
    {
    
        System.out.println( employee[i].name);
}

}
}

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.