View Single Post
Old 05-05-2004, 07:57 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
passing by reference

ok, i'm about to go read up on this, but i thought i'd post this question so when i find the resolution it will help someone in the future.

in my class i have this method:
Code:
public boolean setCustomerByID(customer cust,String id)
{
  // if found set customer object
  return true;

  // if customer not found
  return false;
}
i need this method to return a boolean value, and this is how i want to call it:
Code:
customer c = new customer();
if( myclas.setCustomerByID(c,"1234") ){
  out.println(c.firstName + " " c.lastName);
}else{
  out.println("customer not found");
}
in that example, i would like the setByCustomerID method to return true/false, but i alway want my new customer object 'c' to be set in the process.

at this point, it doesn't seem like customer is passing by reference.

i'm going to go google it now but any insight would be appreciated. i'll post my findings later.
__________________
Mike
sde is offline   Reply With Quote