How to return more than one value from a function in Java? Can someone give some sample code for this using tuples? I can not understand the concept of tuples.
public class Tuple{ public static void main(String []args){ System.out.println(f()); } static Pair<String,Integer> f(){ return new Pair<String,Integer>("hi",3); } public class Pair<String,Integer> { public final String a; public final Integer b; public Pair(String a, Integer b) { this.a = a; this.b = b; } } }
What is the error in the above code?
java tuples return-type
Ajay singh
source share