title: Confusion with point class and driver class in java
body: <p>Basically I had to write a Point class and then a driver class for it, this is done in eclipse as well. The problem I am having is that when I try and call the "pointX and pointY" variables to change the value of the point in the driver class, I keep getting an error. In my instructions the variables had to be declared as private in the PointClass, but then it makes a problem when trying to call them in the PointTest class. Also I'm confused on if my pointers/get &amp; set methods in the PointClass are correctly written.</p>
  
  <p><strong>To clarify on what my requirements were, this is a summary of my instructions:</strong></p>
  
  <ol>
  <li>Write a Point class. The Point class should be written as an abstract data type.</li>
  <li><p>Include the following instance variables:</p>
  
  <p>a. an integer representing the x coordinate</p>
  
  <p>b. an integer representing the y coordinate</p>
  
  <p>c. The instance variables in your program should only be directly accessible inside of the Point class.</p></li>
  <li><p>Have 2 constructors for the Point class.</p>
  
  <p>a. a no-arguments constructor, set both of the instance variables to 10 (ten).</p>
  
  <p>b. a constructor having two arguments, one for each of the two instance variables, set the instance variables to those argument values.</p></li>
  <li><p>Include get and set methods for each of the two instance variables identified in step 2.</p></li>
  <li>Include a toString method in your Point class. </li>
  <li>Write a client program called PointTest</li>
  <li><p>In the PointTest class do the following </p>
  
  <ul>
  <li><p>Create an object of type Point using the no-arguments constructor.
  Call this point1</p>
  
  <p>Create a second object of type Point using the two-argument
  constructor. Call this point2. Use the values of x = 11, y = 24</p>
  
  <p>Display point 1 instance variables after a call to
  point1.toString()</p>
  
  <p>Display point 2 instance variables after a call to
  point2.toString()</p>
  
  <p>Change the x value of point1 to 35 using the set method for the x
  value of point1</p>
  
  <p>Display point 1 instance variables after a call to
  point1.toString()</p>
  
  <p>Display point 2 instance variables after a call to
  point2.toString()</p>
  
  <p>Change the y value of point2 to 13 using the set method for the y
  value of point2</p>
  
  <p>Display point 1 instance variables after a call to
  point1.toString()</p>
  
  <p>Display point 2 instance variables after a call to
  point2.toString()</p></li>
  </ul></li>
  </ol>
  
  <p><strong>The code for the Point class is as follows</strong></p>
  
  <pre><code>    public class PointClass {
  
      private int pointX;     //set instance variables
      private int pointY;
  
  
      public void setPoints() {       //method to set the points values
          pointX = 10;
          pointY = 10;
  
      }
  
      public void getPoints(int x, int y){    //method to set arguments to instance variables 
          pointX = x;
          pointY = y;
      }
  
      /////////////////////////////////////////////////
  
      public int getPointX() {
          return pointX;
      }
  
      public void setPointX(int x) {
          this.pointX = x;
      }
  
      ///////////////////////////////////////////////
  
      public int getPointY() {
          return pointY;
      }
  
      public void setPointY(int y) {
          this.pointY = y;
      }
  
      ///////////////////////////////////////////////
  
      public String toString(){   //toString method to display the values
          return "x = " + pointX + "y = " + pointY;
      }
  
  }
  </code></pre>
  
  <p><strong>The code for the driver is as follows</strong></p>
  
  <pre><code>import java.awt.Point;
  
  public class PointTest{
  
      public static void main(String[] args){
  
          PointClass p = new PointClass();
  
  
          System.out.print("Lab1 Point");
          System.out.print("January 16, 2014");
  
          Point point1 = new Point();             //set point1 as no argument 
          Point point2 = new Point(11,24);       // set point2 as argument with x and y
  
          System.out.print(point1.toString());  //display point1 from toString method
          System.out.print(point2.toString()); //display point2 from toString method
  
          point1 = pointX(35);
  
          System.out.print(point1.toString());  
          System.out.print(point2.toString()); 
  
          point2.pointY(13);
  
          System.out.print(point1.toString());  
          System.out.print(point2.toString()); 
      }
  
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Okay after correcting some stuff, I'm still a bit confused since I'm still getting one error, is this how everything is supposed to be?</p>
  
  <pre><code>public class PointClass {
  
  private int pointX;     //set instance variables
  private int pointY;
  
  
  public void setPoints() {       //method to set the points values
      pointX = 10;
      pointY = 10;
  
  }
  
  public PointClass(int x, int y){    //method to set arguments to instance variables 
      this.pointX = x;
      this.pointY = y;
  }
  
  /////////////////////////////////////////////////
  
  public int getPointX() {
      return pointX;
  }
  
  public void setPointX(int x) {
      this.pointX = x;
  }
  
  ///////////////////////////////////////////////
  
  public int getPointY() {
      return pointY;
  }
  
  public void setPointY(int y) {
      this.pointY = y;
  }
  
  ///////////////////////////////////////////////
  
  public String toString(){                       //toString method to display the values
      return "x = " + pointX + "y = " + pointY;
  }
  
  }
  </code></pre>
  
  <p>public class PointTest{</p>
  
  <pre><code>public static void main(String[] args){
  
  
      System.out.print("Lab1 Point");
      System.out.print("January 16, 2014");
  
      PointClass point1 = new PointClass();         //set point1 as no argument 
      PointClass point2 = new PointClass(11, 24);  // set point2 as argument with x and y
  
      System.out.print(point1);  //display point1 from toString method
      System.out.print(point2); //display point2 from toString method
  
      point1.setPointX(35);
  
      System.out.print(point1);  
      System.out.print(point2); 
  
      point2.setPointY(13);
  
      System.out.print(point1);  
      System.out.print(point2); 
  }
  
  }
  </code></pre>