In the below given examples, we will create Pair using the constructor and demonstrate how to get the string equivalent of the Pair using the toString() function?
toString() function:
The toString() function returns string representation of the Pair including its first and second values.
Syntax:
fun toString(): String
Example 1:
Output:
Example 2:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer