Monday, 21 September 2020

Scala: apply method can be called without name

 "Hello World"(6) is same as "Hello World".apply(6)

scala> "Hello World"(6)
val res48: Char = W

scala> "Hello World".apply(6)
val res49: Char = W

 


Previous                                                    Next                                                    Home

No comments:

Post a Comment