+ 2

What are the various ways to take multiple return values from a method in JAVA?

Ex : return x,y;

8th Feb 2017, 9:46 AM
tharun surya dwivedula
tharun surya dwivedula - avatar
1 Odpowiedź
+ 2
pass in a container, I believe this pattern is known as the wrapper. class WrappedInts{ int a,b,c; } void modInts(WrappedInts w) { w.a = 4; w.b = 2; w.c = 1; }
8th Feb 2017, 10:06 AM
Leon
Leon - avatar