Member, class, accessibility clarification

Here is an example that I can't understand:

abstract class Personne { 
    protected static int nbPersonnes=0;

    static void nbpersonnes (){
    System.out.println(
    “\n Nombre d’employés :“ + nbPersonnes +
    “\n Nombre de secretaires  : “ + Secretaire.nbSecretaire() +

    }

The second class is Secretaire:

class Secretaire extends Personne {        
       private String numBureau;
       private static int nbSecretaires; 
       Secretaire (String nom, String prenom, String rue,String ville,String numBureau) {
          super(nom,prenom,rue,ville);
          this.numBureau=numBureau;
          nbSecretaires++;}

How can the class Personne access private member Secretaire.nbSecretaire()?

I thought the class Secretaire can access Personne members, and not the opposite? nbSecretaires is a private member. How can it be accessed outside the class?

Jon Skeet
people
quotationmark

i thought class Secretaire can access Personne'members, and not the opposite ?

That would be true in C#, but not in Java.

In Java, all the code within the same top-level class can access all the private members of all the classes declared within that top-level class (including the top-level class itself).

From JLS 6.6.1:

Otherwise, the member or constructor is declared private, and access is permitted if and only if it occurs within the body of the top level class (§7.6) that encloses the declaration of the member or constructor.

people

See more on this question at Stackoverflow