The mkString() method belongs to the concrete value member of the class Abstract Iterator. It is utilized to display all the elements of the collection in a string.
val result = iter.mkString
Here, we are storing string in result variable.
It returns the string representation of the stated collection.