What is wrong in my code?

package arrays;

import java.util.*;

public class sortgame {
String name;
int salary;

public sortgame(String name, int salary) {

	this.name = name;
	this.salary = salary;
}

public static void main(String[] args) {
	Scanner scn = new Scanner(System.in);
	int s = scn.nextInt();
	int n = scn.nextInt();

	sortgame[] arr = new sortgame[n];

	for (int i = 0; i < n; i++) {
		String name = scn.next();
		int salary = scn.nextInt();

		arr[i] = new sortgame(name, salary);
	}
	Arrays.sort(arr);
	for (int i = 0; i < n; i++) {
		if (arr[i].salary >= s) {
			for (int j = 1; j < n; j++) {
				if (arr[i].name.compareTo(arr[j].name))
					System.out.println(arr[i].name + " " + arr[i].salary);
			}
		}
	}
}

}

@harsh.hj,

https://ide.codingblocks.com/s/323292 corrected code.

Write your own comparator before proceeding.

sir we haven’t studied interface and generics and this questions comes under arrays section.why the arrangement of questions and lectures in this course is worse

@harsh.hj,
It is an array question only. Its just that the array type instead of int/long/char, in this case you have to define the array type

sir why doubly linked list and circular linked list are not included in this course???

@harsh.hj,
They must be included in one of the lectures. For content related queries please drop a mail to: [email protected]

no sir i have gone through the linked list section .these sections were not included in any of the lectures

sry these topics were not included

@harsh.hj,
Buddy, I really cannot help you with content related queries. For content related queries please drop a mail to: [email protected]