I recently started learning basics of Java and got stuck on this doubt. How to write Java code for the below given C++ code. Note that making a class and passing an object or returning some object looks like a hack to me. So looking for other possible answers.
// c++ code
void f(int & x, int & y) {
x++;y++;
}
f(x, y); // function call somewhere
Thanks