Got an iPhone or iPad? We have a brand new Pastebin App for both devices, and it's totally free! Click here to download the new Pastebin App for iOS.
Guest

Untitled

By: a guest on Feb 9th, 2010  |  syntax: Java  |  size: 0.64 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. public class Shape
  2. {
  3.    private int x, y;    // coordinates of shape
  4.  
  5.    // constructor
  6.    public Shape( int x, int y )
  7.    {
  8.       this.x = x;
  9.       this.y = y;
  10.    }
  11.  
  12.    // set x coordinate
  13.    public void setX( int x )
  14.    {
  15.       this.x = x;
  16.    }
  17.  
  18.    // set y coordinate
  19.    public void setY( int y )
  20.    {
  21.       this.y = y;
  22.    }
  23.  
  24.    // get x coordinate
  25.    public int getX()
  26.    {
  27.       return x;
  28.    }
  29.  
  30.    // get y coordinate
  31.    public int getY()
  32.    {
  33.       return y;
  34.    }
  35.  
  36.    public String getName()
  37.    {
  38.       return "Shape";
  39.    }
  40.  
  41.    public String toString()
  42.    {
  43.       return "Shape";
  44.    }
  45. }  // end class Shape