Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Replies
    9
    Views
    1,007

    Re: Help with get and set

    It should be better if you do the set and get on the same instance instead of different ones.
  2. Replies
    9
    Views
    1,007

    Re: Help with get and set

    You have two instances of a class. You call setY for one and change it's y value.
    When you call getY you get the y value from the other instance of the class which is never changed from 0.

    Can...
  3. Replies
    9
    Views
    1,007

    Re: Help with get and set

    How many instances of the class were created?
    For which instance is the setY method called?
    For which instance is the getY method called?
    Add a 'this' to the printlns to see:
    ...
  4. Replies
    9
    Views
    1,007

    Re: Help with get and set

    Add printlns to the constructors to show when each class is created and how many of them.

    You could use the 'this' variable in the printlns to get an id for each class.
  5. Replies
    9
    Views
    1,007

    Re: Help with get and set

    Try debugging your code by adding printlns to show the values of variables as their values are changed.
    The output should show when the variable has been given a good value and when it has been set...
Results 1 to 5 of 5