Implicit Classes, Scala.
behavior of the class. Examples: Here’s an example to illustrate the difference between implicit classes that extend AnyVal and those that do not. Let’s say we want to add a method to the Int type that squares its value. We can define an implicit class that takes an Int value and adds this method: