Skip to content
Advertisement

Converting C++ code to JAVA

JavaScript

I have to convert my code to Java Code I already converted but i couldn’t find my mistake i cannot point variables to each other..

JavaScript

This is my java code when i look at the int sum1 = (i / 2) + fun(k.value=i); int sum2 = fun(k.value=j) + (j / 2); part isn’t true about point to true values. How can i solve that pointers problem. Thank you.

Advertisement

Answer

The problem is that you’re using ints instead of intobjs where you want to pass things around by reference (& in c++).

In your main function, you should try declaring i and j as intobjs and your parameter for fun, k should also be an intobj.

Code:

JavaScript
Advertisement