View Single Post
Old 11-03-2003, 10:13 PM   #7 (permalink)
npa
Code Monkey
 
Join Date: Jul 2003
Location: canada
Posts: 82
npa is on a distinguished road
> can you pass by refrence in Java?

nope ...


java passes primatives by value and objects
by reference copy ...

> java is passing a pointer (er, "reference").
> ... yes, it is passing the value of

no it doesn't - it passes a copied object's reference.

otherwise code like this:
Code:
void a(Object obj){
  obj = null;
}

void b(){
  Object o = new Object();
  a(o);
  if(null == a){
   System.out.println("not possible");
  }
}
would print "not possible". - it wont.
__________________
direct entry file specification.
npa is offline   Reply With Quote