title: Different methods access in different classes
body: <p>Below is the code structure:
  I want class C to only access M1() of class A &amp; M3() of class B, other methods like M2() &amp; M4() should not be visible here.
  And class D to access M2() of class A &amp; M4() of class B, other methods like M1() &amp; M3() should not be visible here.</p>
  
  <p>Code packages, access levels modifications is permitted. Just wanna achieve above thing.</p>
  
  <pre><code>public class A{
      &lt;access_specifier&gt; void M1()
      {
  
      }
      &lt;access_specifier&gt; void M2()
      {
  
      }
  }
  
  public class B{
      &lt;access_specifier&gt; void M3()
      {
  
      }
      &lt;access_specifier&gt; void M4()
      {
  
      }
  }
  
  public class C{
      public static void main(String args[]){
  
      }
  }
  
  public class D{
      public static void main(String args[]){
  
      }
  }
  </code></pre>