What’s Wrong In this Programme Why They Give in Compile Error
import java.util.*;
public class Main {
String name;
int salary;
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int salcap = scn.nextInt();
int n = scn.nextInt();
Sort_Game[] array = new Sort_Game[n];
for (int i = 0; i < n; i++) {
array[i] = new Sort_Game();
}
for (int i = 0; i < n; i++) {
scn.nextLine();
array[i].name = scn.next();
array[i].salary = scn.nextInt();
}
ArrayList<Integer> uni = sort(array);
boolean unique_or_not = true;
for (int i = 1; i < uni.size(); i++) {
sort(array, uni.get(i - 1), uni.get(i) - 1);
if (uni.get(i - 1) != uni.get(i) - 1)
unique_or_not = false;
}
if (unique_or_not) {
for (int i = 0; i < array.length; i++) {
System.out.println(array[i].name + " " + array[i].salary);
}
} else {
for (int i = 0; i < array.length; i++) {
if (array[i].salary >= salcap)
System.out.println(array[i].name + " " + array[i].salary);
}
}
}
public static ArrayList<Integer> sort(Sort_Game[] array) {
for (int i = array.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (array[j].salary < array[j + 1].salary) {
Sort_Game temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
ArrayList<Integer> uni = new ArrayList<>();
uni.add(0);
for (int i = 1; i < array.length; i++) {
if (array[i].salary != array[i - 1].salary) {
uni.add(i);
}
}
return uni;
}
public static void sort(Sort_Game[] array, int si, int ei) {
for (int i = ei; i > si; i--) {
for (int j = si; j < i; j++) {
if (array[j].name.compareTo(array[j + 1].name) > 0) {
Sort_Game temp = array[j];
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
}
}