As stated before, all values in Scala are objects. When an object is created, the system automatically saves the memory address of that object, which is now the reference value for the object. Learn why this is important.
- [Woman] Let's take a look at declaring variables in Scala.…As we stated before, all values in Scala are objects.…When an object is created, the system automatically saves…the memory address of that object,…which is now the reference value for the object.…In Scala, we have a hierarchy of data types,…as you can see here.…The top level is called Any.…This represents the reference value of any object,…but some objects can be defined at a more granular level.…In this diagram of data types,…you can see that Any has two subtypes.…
On the left, we have AnyVal and on the right we have AnyRef.…On the left, individual items can be defined…as Int, Double, Boolean, et cetera.…Each one of those is represented by AnyVal,…which is represented by Any.…On the right, we have data types,…such as String, Vector, Array, and they are part of AnyRef.…When we start to mix values in one list, then we have…to find the first common type up the hierarchy chain.…
So for example, if our list has both a Double and a Boolean,…the data type would be automatically converted to AnyVal,…
- Installing Scala
- Integrating with IDEs
- Creating variables
- Using special functions
- Basic types and operations
- Tuples, sets, maps, arrays, and lists
- Classes, fields, and methods
- Singleton objects
Skill Level Intermediate
1. Why Scala?
2. Scala Basics
3. More Scala Basics
4. Objects with Scala
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.