'toString' and 'mkString'

Viewing 1 reply thread
  • Author
    Posts
    • #6589
      DataFlair TeamDataFlair Team
      Spectator

      ‘mkString’ is used in place of ‘toString’ in ‘ScoreAnalysis’ program. Any particular reason to use mkString or is it just to demonstrate various functions that are used for the same purpose?

    • #6590
      DataFlair TeamDataFlair Team
      Spectator

      We read a text file into an iterator.. Hence, if you perform toString(), it won’t return the contents of the file. It returns the string representation of the iterator object.
      Then, mkString() will read the iterator & loop over the values and create the String based on the values.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.