With the help of an example show how can you return more than one value from a function.
Answers
Answered by
0
Answer:
If you use if statement or condition based statements then you can have more than 2 return types.
OR you could return an array
import java.util.*;
class GfG {
public static List<Object> getDetails()
{
String name = "Geek";
int age = 35;
char gender = 'M';
return Arrays.asList(name, age, gender);
}
// Driver code
public static void main(String[] args)
{
List<Object> person = getDetails();
System.out.println(person);
}
}
Answered by
0
Answer:
it is a answer of this question
Attachments:
Similar questions
Computer Science,
5 months ago
Math,
5 months ago
India Languages,
10 months ago
India Languages,
10 months ago
English,
1 year ago
English,
1 year ago