In the past week i have been using function like these too much
function Rectangle setRectangle(Rectangle rect){
rect = new Rectangle(p,q,r,s);
return rect;
}
Rectangle rect;
rect = setRectangle(rect);
I just want to do
function void setRectangle(Rectangle rect){
rect = new Rectangle(p,q,r,s);
}
Rectangle rect;
setRectangle(rect);
I know there are pointers in c++ in which we can just set the pointer to whatever in the function and it is set in the real variable. I want to know how I can do it in Java.