public class Doubt1{
    public static void main(String[] args){
        Manager m1 = new Manager(25000);
        Manager m2 = new Manager(25000);``
        System.out.println(m1.getSalary(250000) + " " + m2.getSalary()); //how is m1.getSalary working when getSalary(int) is protected in Employee class
    }
}
class Employee{
    protected int salary;
    public Employee(int s){
        salary = s;
    }
    protected int getSalary(int s){
        return salary + s; 
    }
}
class Manager extends Employee{
    public Manager(int s){
        super(s);
    }
    public int getSalary(){
        return salary;
    }
}
I have overloaded getSalary method from Employee class in manager class. getSalaray(int) method of Employee class has protected access and hence, can only be accessed from Manager class. But when I call m1.getSalary(25000), why is the compiler not complaining about "protected access in employee class" as it does when I declare the method private? Or is protected access modifier something else than what I assume it to be?
 
    