VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-set-tostring-method-with-example/

⇱ Scala Set toString() method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Set toString() method with example

Last Updated : 18 Oct, 2019
The toString() method is utilized to return a string consisting of all the elements of the set.
Method Definition: def toString(): String Return Type: It returns a string consisting of all the elements of the set.
Example #1:
Output:
Set(5, 1, 2, 3, 4)
Example #2:
Output:
Set(1, 41, 12, 72, 43, 23)
Comment

Explore