title: How to use a private method in Java
body: <p>I am given a class that has a private method say setCoors(int x, int y). The constructor of that class has the setCoors in it too. In a different class, I want to have a method setLocation which calls setCoors. Is this possible? </p>
  
  <p>New Question:</p>
  
  <p>If I am not allowed to set the method to public, is this possible?</p>
  
  <pre><code>public class Coordinate{
      public Coordinate(int a, int b){
          setCoors(a,b)
      }
      private void setCoords(int x, int y)
  }
  
  public class Location{
      private Coordinate  loc;
      public void setLocation(int a, int b)
          loc = new Coordinate(a,b)
  }
  </code></pre>