Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26
  1. #21
    SergeLo is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: Found a bug, need others to confirm.

    Before Trues: 3084
    After Trues: 3071
    Before/After Difference: 13
    Drops Hit: 13
    Before Trues: 3084
    After Trues: 3059
    Before/After Difference: 25
    Drops Hit: 25
    Before Trues: 3072
    After Trues: 3059
    Before/After Difference: 13
    Drops Hit: 13
    Before Trues: 3072
    After Trues: 3047
    Before/After Difference: 25
    Drops Hit: 25
    Before Trues: 3060
    After Trues: 3047
    Before/After Difference: 13
    Drops Hit: 13
    Before Trues: 3060
    After Trues: 3035
    Before/After Difference: 25
    Drops Hit: 25
    Before Trues: 3048
    After Trues: 3035
    Before/After Difference: 13
    Drops Hit: 13
    Before Trues: 3048
    After Trues: 3023
    Before/After Difference: 25
    Drops Hit: 25
    Before Trues: 3036
    After Trues: 3023
    Before/After Difference: 13
    Drops Hit: 13
    Before Trues: 3036
    After Trues: 3011
    Before/After Difference: 25
    Drops Hit: 25
    Before Trues: 3024
    After Trues: 3011
    Before/After Difference: 13
    Drops Hit: 13

    omg, yellowledbet you are my hero! :)))
    all i was trying to do is to move all sub arrays down a level in the main array, dropping the last one and keeping the first one untouched.

    so, hold on. what exactly was going on with what i had before??
    can someone explain?
    Last edited by SergeLo; 04-03-2012 at 05:00 AM.

  2. #22
    yellowledbet is offline Senior Member
    Join Date
    Feb 2011
    Location
    Georgia, USA
    Posts
    122
    Rep Power
    0

    Default Re: Found a bug, need others to confirm.

    glad it worked. I am sure someone can explain this better, but I will give it a shot. Arrays are passed by reference (EDIT: The preceding statement is false, see DarrylBurke's link for clarification). So instead of changing the values in each array within your array you were changing the reference to the array. If you think about the cumulative effect of this, you are making a bunch of array variables point to the same array.
    Last edited by yellowledbet; 04-03-2012 at 01:16 PM.

  3. #23
    SergeLo is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: Found a bug, need others to confirm.

    ahhhh! gotcha!
    so as i was moving them down over an over, eventually the whole array held references to the first element in the array. so when one thing changed so did the ones above... Which is what led me to think that one assignment changed more than one location when each one was really the same location.
    Thank You :)
    Last edited by SergeLo; 04-03-2012 at 06:27 AM.

  4. #24
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default Re: Found a bug, need others to confirm.

    Quote Originally Posted by yellowledbet View Post
    Arrays are passed by reference.
    No they are not. Array and other object references are passed by value, which isn't the same thing.

    Recommended reading, in the order listed:

    JavaRanch Campfire - Cup Size: a Story About Variables
    JavaRanch Campfire - Pass By Value, Please

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #25
    SergeLo is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: Found a bug, need others to confirm.

    haha, i enjoyed that.
    Daryl, what yellowledbet said by definition is wrong, but I'm sure what he meant by passing by reference is passing the value of the reference.

    now... my rain array then means that its a remote in control of many other remotes... O.o

    Anyways, thanks for ur help aswell Daryl
    Last edited by SergeLo; 04-03-2012 at 09:27 AM.

  6. #26
    yellowledbet is offline Senior Member
    Join Date
    Feb 2011
    Location
    Georgia, USA
    Posts
    122
    Rep Power
    0

    Default Re: Found a bug, need others to confirm.

    Quote Originally Posted by DarrylBurke View Post
    No they are not. Array and other object references are passed by value, which isn't the same thing.

    Recommended reading, in the order listed:

    JavaRanch Campfire - Cup Size: a Story About Variables
    JavaRanch Campfire - Pass By Value, Please

    db
    Thank you for the correction and the links. That phrasing has always confused me, the reading clears it up.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Confirm Dialog box ?
    By ady_bavarezu89 in forum AWT / Swing
    Replies: 13
    Last Post: 06-11-2011, 01:56 PM
  2. Confirm dialog+pass parameters
    By barcelonax in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 12-21-2010, 08:20 AM
  3. show Confirm Perspective Switch dialog box
    By mostafa in forum Eclipse
    Replies: 0
    Last Post: 11-22-2008, 11:47 AM
  4. Yes/No confirm dialog box
    By mandrake446 in forum Advanced Java
    Replies: 2
    Last Post: 12-09-2007, 05:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •