Display function not working properly

import java.util.Scanner;
class Employee implements Comparable{
String name;
int salary;

Employee(String name,int salary){
	this.name=name;
	this.salary=salary;
}
@Override
public int compareTo(Employee o) {
	// TODO Auto-generated method stub
	return o.salary-this.salary;
}
@Override
public String toString() {
	String temp=this.name+" "+salary;
	return temp;
}

}
public class SortGame {

public static void main(String[] args) {
	Scanner scn =new Scanner(System.in);
	int min=scn.nextInt();
	int num=scn.nextInt();
	Employee[] employ=new Employee[num];
	for(int i=0;i<num;i++) {
		String name=scn.nextLine();
		scn.nextLine();
		int salary=scn.nextInt();
			employ[i]=new Employee(name, salary);
	}
	sort(employ);
	display(employ);
}
public static <T extends Comparable<T>> void sort(T[] arr) {
	for(int counter=0;counter<arr.length-1;counter++) {
		for(int j=0;j<arr.length-1-counter;j++) {
			if((arr[j].compareTo(arr[j+1]))>0) {
				T temp=arr[j];
				arr[j]=arr[j+1];
				arr[j+1]=temp;
			}
		}
	}
}
public static <T> void display(T[] arr) {
	for (T val : arr) {
		System.out.println(val);
	}
}

}

My display function is Not Concatenating Employee name.

@ubaidshaikh9999,
https://ide.codingblocks.com/s/240710 corrected code.

Don’t use nextLine for string. Use next.
Your comparator has an error.
Specify the type of comparable. (that’s why you were getting an error)

I have corrected the code and commented the errors.

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.