当前位置:网站首页>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}")
}
}
边栏推荐
- 最新QQ微信域名防红PHP程序源码+强制跳转打开
- Mobile security tool -dex2jar
- Use of navigation and navigationui
- JMeter socket connection sends data
- Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
- placeholder
- 2022R1快开门式压力容器操作考题及答案
- 移动安全工具-dex2jar
- redis + lua实现分布式接口限流实现方案
- Solution to network access packet loss of Tencent cloud international ECS
猜你喜欢

2022r1 quick opening pressure vessel operation test questions and answers

Tiktok wallpaper applet, starlight wallpaper applet version 2.0, upgraded version

Rich text tables, lists, pictures

iNFTnews | 国内NFT发展仅限于数字藏品吗?

QT (35) - operate excel qxlsx qaxobject

2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination

打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?

Custom animation (simulated win10 loading animation) - Optimization

Kubernetes 架构核心组件工作原理解析

Text editor for QT project practice -- Episode 9
随机推荐
I 刷题 I — 复制带随机指针的链表
JSON file of China's provincial boundaries
Golang示例续期锁:Redis+Channel+sync.Mutex
Go crawler framework -colly actual combat (4) -- Zhihu answer crawl (2) -- visual word cloud
Wallpaper applet wechat applet
Use of navigation and navigationui
How to reduce the font size of custom controls (optimize the round dot progress bar)
Practical operation notes - notebook plus memory and ash cleaning
A small crawler program written by beginners
百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
Sanic service startup failed
2021-11-07
Syntax highlighting of rich text
Sanic服务启动失败
智能合约安全审计入门篇 —— delegatecall (2)
热力图展示相关矩阵
How to quickly open traffic master for wechat applet
2021-04-18
Go crawler framework -colly actual combat (III) -- panoramic cartoon picture capture and download