In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to understand the basic types of Scala". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to understand the basic types of Scala.
Types in Scala are closer to the idea of. Net than Java. All types are based on a base type, including value types that also inherit from that type.
The Java median type is provided directly by the language, which is a little different.
The type diagram is as follows:
Where all types of base classes are associated with Any
Any is then divided into two AnyVal and AnyRef
Where AnyVal is the parent of all value types
AnyRef is the parent of all reference types
Slightly different from other languages, Scala also defines the bottom type
Where the Null type is the bottom type of all reference types, and the null value of all AnyRef types is Null
Nothing is the bottom type of all types, corresponding to the Any type.
Both Null and Nothing are empty, which can be understood at a glance.
Among the underlying types, only String inherits from AnyRef, and like Java and. Net, String in Scala is also a memory immutable object, which means that all string operations produce new strings.
Other basic types such as Int are wrapped by Scala, for example, the Int type corresponds to Scala.Int, but the Scala package is automatically referenced by each source file, and it looks as if the Int type is directly built into the language.
Thank you for your reading, the above is the content of "how to understand the basic types of Scala". After the study of this article, I believe you have a deeper understanding of how to understand the basic types of Scala, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.