Hi:
How would you handle situations when you need a C++ double pointer in Java?

e.g. Imagine we necessarily wanted to use the "new" operator in func2(). How would we be able to send the newly created object back to func1()?
Note that since parameter "b" in func2() is NOT sent by a double pointer, here is what happens in func2(): temporary pointer "b" contains the address of original object B created in func1(). Then new object B is created and the temporary pointer "b" will contain its address, pointing to the new object, however, the real pointer "b" in func1() will not point to anything different as the temporary pointer "b" is only a copy of pointer "b" in finc1().

class B
{
public int b1;
public B( int b1 ) { this.b1 = b1; }
}
class A
{
public void func1()
{
B b = new B( 0 );
func2( b );
System.out.println( String.valueOf( b.b1 ); //will print "0" ( not "2" )
}
public void func2( B b )
{
b = new B( 2 );
//b.b1 is now 2, but this new object will be lost as soon as we are out
//of this method
}
}