title: private keyword when calling methods
body: <p>This is a piece of code that I have that I'm testing right now, and I noticed that when I change public to private on the getInfo() method in Person, both Student().printPerson() &amp; Person().printPerson() print out "Person". However, when it's public, "Student" is displayed. Can someone explain this? Why is it that the private modifier disallows access to the getInfo method from Student? </p>
  
  <pre><code>        new Student().printPerson();
          new Person().printPerson();
        }
      }
  
      class Student extends Person {
          public Student(){
          System.out.println("student invoked")   ;
          }
  
        public String getInfo() {
          return "Student";
        }
      }
  
      class Person {
       public Person(){
  
      System.out.println("person invoked");
  
       }
          private String getInfo() {
          return "Person";
        }
  
        public void printPerson() {
          System.out.println(getInfo());
        }
  </code></pre>