Scala Data Types
Scala’s unified type system
Anyis the super type- Defines methods like -
equals,hashCode,toString
- Defines methods like -
AnyValrepresents value types.- Double
- Float
- Long
- Int
- Short
- Byte
- Char
- Unit - Only one instance can be there -
() - Boolean
AnyRefrepresent refernce types likeListNothingis subclass for all value types.Nullis subclass for all reference types. Should not be used in Scala code.
Type Casting
Type casting is unidirectional
Source - https://docs.scala-lang.org/tour/unified-types.html