Java Equivalent of a C++ Function

Revision en2, by dreamplay, 2017-08-17 19:26:39

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

Tags #java, #c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English dreamplay 2017-08-17 19:26:39 0 (published)
en1 English dreamplay 2017-08-17 19:26:15 422 Initial revision (saved to drafts)