The problem is that you only have one
employee
object:
int num = sc.nextInt();
employee a = new employee();
for(int i=0;i<num;i++){
a.info();
}
for(int j=0;j<num;j++){
a.displayinfo();
}
It does not matter how many times the first loop runs you will only have the information of the last set of data entered, since you overwrite it each time round. You need to create a List or Array to hold each employee's details as you enter them.