Rename the method

Report a typo

Fix the class code so that we can combine messages as follows:

Message("Hello ") |+| Message("World!") // Message("Hello World!")

Sample Input 1:

Message("Hello ")
Message("World!")

Sample Output 1:

Hello World!
Write a program in Scala 3
class Message(val text: String):
def concatenate(other: Message): Message = Message(text + other.text)
___

Create a free account to access the full topic