Link to home
Start Free TrialLog in
Avatar of vincentk111600
vincentk111600

asked on

java "newbie" confused by what seems like garbage collection details

i am confronted with a method which behaves about like so

public static AType parse(BType bb) {

  /* ... do some stuff  */

  bb = parseBB(bb);

  /* MARK X */

  /* ... do some stuff */

  return parseAA();
}

public static BType parseBB(BType bb) {

  bb = new BType();
 
  bb.field = foo;

  return bb;
}


now at MARK X, bb.field has value foo, however, when i call parse(bb) and then inspect bb.field, it has a value of null. what gives? what do i need to do to make the value of bb.field persist? is that
possible at all?
Avatar of Tim_Heldberg
Tim_Heldberg

I dont know exactly what you are asking, but it looks like you are passing BType bb to parseBB and then making bb point at a new BType object.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
:-)