Scala’s class hierarchy starts with the
Any class
in the scala package. It contains methods like ==, !=, equals, ##, hashCode, and toString.
abstract class Any {
final def ==(that: Any): Boolean
final def !=(that: Any): Boolean
def equals(that: Any): Boolean
def ##: Int
def hashCode: Int
def toString: String
// ...
}
Every class in Scala inherits from the abstract class Any. It has two immediate subclasses, AnyVal and AnyRef, as shown in Figure 4-1.
Figure 4-1
Every ...