title: Can I limit the methods another class can call in Java?
body: <p>Let's assume I have classes <code>A</code>, <code>B</code>, and <code>C</code> where class <code>C</code> has readable and writable properties:</p>
  
  <pre><code>public class C {
      private int i = 0;
  
      // Writable.
      public void increment() { i++; }
  
      // Readable.
      public int getScore() { return i; }
  }
  </code></pre>
  
  <p>Is it possible to only let <code>A</code> use the <code>increment()</code> method and only let <code>B</code> use the <code>getScore()</code> method?</p>