当前位置:网站首页>Scala sample class
Scala sample class
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
// Sample class
// Scala in , The sample class is a special class , It is generally used to save data ( Be similar to Java Bean), In concurrent programming and Spark、Flink It is often used in these frameworks
// Format
// case class Sample class name ([var/val] Member variable name 1: type 1, Member variables 2: type 2, Member variable name 3: type 3){}
//
// If you don't write , The default modifier of the variable is val, namely val Omission
// If you want to implement a member variable, the value can be modified , You need to add it manually var To modify variables
object Sample class {
case class Person(name: String = " Zhang San ", var age: Int = 10) {
}
def main(args: Array[String]): Unit = {
val p = Person()
println(s" Before the change :name = ${p.name}, age = ${p.age}")
// p.name="" // Report errors , The default modifier without is val, Do not modify the
p.age = 18
println(s" After modification :name = ${p.name}, age = ${p.age}")
}
}
边栏推荐
- The problem of multiple callback of video ads stimulated by applets (offcolse problem)
- Kibana installation via kubernetes visual interface (rancher)
- Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
- Tiktok wallpaper applet v1.0.2 function, new arrival function
- Go crawler framework -colly actual combat (4) -- Zhihu answer crawl (2) -- visual word cloud
- adb shell getevent
- Redis + Lua implementation of distributed interface current limiting
- QT(35)-操作EXCEL-QXlsx-QAxObject
- Previous basic review (link)
- Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022
猜你喜欢

Practical operation notes - notebook plus memory and ash cleaning

【微服务|Sentinel】实时监控|RT|吞吐量|并发数|QPS

2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作

How to quickly open traffic master for wechat applet

2022r1 quick opening pressure vessel operation test questions and answers

Unimportant tokens can be stopped in advance! NVIDIA proposes an efficient visual transformer network a-vit with adaptive token to improve the throughput of the model

Activity startup process

Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022

ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string

Encryption and encoding resolution
随机推荐
VNC viewer remote connection raspberry pie without display
Applet opening traffic master
腾讯云国际云服务器网络访问丢包问题解决办法
百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
adb shell getevent
QT electronic clock
Android SQLite database
The picture of wechat official account can not be displayed normally
Tiktok wallpaper applet v1.0.2 function, new arrival function
Scrollview height cannot fill full screen
Tiktok wallpaper applet source code
Previous basic review
Examination questions and mock examination for safety management personnel of hazardous chemical business units in 2022
2021-11-07
A plug-in framework for implementing registration free and login verification with hook technology
The problem of multiple callback of video ads stimulated by applets (offcolse problem)
2022 melting welding and thermal cutting recurrent training question bank simulated examination platform operation
[microservices sentinel] cluster link | microservices cluster environment construction
Technologie des fenêtres coulissantes en octets dans la couche de transmission
ServerSocket and socket connection