I just start learning Java and the things that occur to me are that they don't have passing by reference like c++ does. How do I change the value of object variable after I passing it to function?
public static doStuff(Node x, Node currentNode){
if(x == null)
x = currentNode;
}
public static void main(String []args) {
Node x = null;
Node newNode = new Node()
doStuff(x,newNode);
System.out.println(x) // --> This one supposed to be different than null
}