About 21,600,000 results
Open links in new tab
  1. How to return 2 values from a Java method? - Stack Overflow

    May 14, 2010 · You can use SimpleEntry<type_of_value_1, type_of_value_2> from java.util.AbstractMap.SimpleEntry and use it with getKey() to get object 1 and getValue() to get …

  2. How to Return Multiple Values From a Java Method - Baeldung

    May 11, 2024 · In this tutorial, we’ll learn different ways to return multiple values from a Java method. First, we’ll return arrays and collections. Then we’ll demonstrate how to use container …

    Missing:

    • Main

    Must include:

  3. Returning Multiple values in Java - GeeksforGeeks

    Sep 13, 2018 · We can use following solutions to return multiple values. If all returned elements are of same type. We can return an array in Java. Below is a Java program to demonstrate the …

  4. java - How to return multiple values? - Stack Overflow

    If you want to return unrelated values, then you can use Java's built-in container classes like Map, List, Set etc. Check the java.util package's JavaDoc for more details.

  5. java - return two variables from one method - Stack Overflow

    Oct 27, 2014 · You cannot return two different values in methods in Java. When this need occurs, you usually have two options: Create a class which has the types you want to return, and then …

  6. Return multiple values from a method in Java | Techie Delight

    Oct 25, 2023 · This post will discuss how to return multiple values from a method in Java using a POJO class, an array, collection, delimiter & javafx.util.Pair class

  7. Return Multiple Values in Java [5 Different Methods]

    Feb 22, 2022 · We can use any of the five shown approaches as per the program requirement to return multiple values in Java. Return an array of specific type or object, Return using the Pair …

  8. How to Return Two Values in Java Function - Delft Stack

    Feb 2, 2024 · In Java, there is no privilege to return two values to a function. The resolution to the problem that comes with multi-value returns can be solved by either creating a user-defined …

  9. Java Method Return Multiple Values - A Comprehensive Guide

    This tutorial will explore how to return multiple values in Java using various techniques, including arrays, collections, and custom objects. Understanding how to return multiple values can …

  10. How to return multiple values from a method in Java

    Apr 30, 2019 · There is the option to return a Map.Entry<K,V>, you could use an Integer as key and the Boolean as value... You could return an array, a map or even better a custom class to …

Refresh