O'Reilly logo

Scala for Java Developers: A Practical Primer by Toby Weston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Toby Weston 2018
Toby WestonScala for Java Developershttps://doi.org/10.1007/978-1-4842-3108-1_4

4. Scala’s Class Hierarchy

Toby Weston
(1)
London, UK
 
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.
A456960_1_En_4_Fig1_HTML.jpg
Figure 4-1
Every ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required