title: How can I use set methods to set data field?
body: <p>In one class, I am defining a setX method</p>
  
  <pre><code>public class Point{
  int x;
  int y;
  ...
  
  public int setX(int x){
  this.x = x;
  }
  
  ...
  }
  </code></pre>
  
  <p>And in another class, I need to create a point object and set its x field to be 1, I do not know what to write. This is what I write</p>
  
  <pre><code>public class Lab1{
   public static void main (String[] args){
  Point a;
  
  a.x = new setX(1);
  ...
   }
  }
  </code></pre>
  
  <p>what should I do?</p>