previous | start | next

Scope: Example 2

Variable Scope
x Lines 4 - 21
y Lines 5 - 21
xcoord Lines 7 - 10
    1   public class Point
    2   {
    3      private int x;
    4      private int y;
    5   
    6      public Point(int xcoord, int ycoord)
    7      {
    8         x = xcoord;
    9         y = ycoord;
   10      }
   11   
   12      public int getX()
   13      {
   14        return x;
   15      }
   16   
   17      public int getY()
   18      {
   19        return y;
   20      }
   21   
   22   }


previous | start | next