Since Java doesnt support pointers, How is it possible to call a function by reference in Java like we do in C and C++??
In Java, except for primitives, passing Object to a method/function is always by reference. See Oli Charlesworth's answer for the example.
For primitive types, you can wrap it using array: For example:
public void foo(int[] in){
in[0] = 2;
}
int[] byRef = new int[1];
byRef[0] = 1;
foo(byRef);
// ==> byRef[0] == 2.