当前位置:网站首页>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}")
}
}
边栏推荐
- Jar package merging using Apache ant
- QT (35) - operate excel qxlsx qaxobject
- Can communication experiment between C and C
- 傳輸層 以字節為單比特的滑動窗口技術
- A plug-in framework for implementing registration free and login verification with hook technology
- Qiniu cloud uploads video to get the first frame of video
- Single blind box removal, social blind box and friend blind box program source code
- Leetcode 1248. 统计「优美子数组」(害,突然发现只会暴力枚举了)
- 断言(assert)的用法
- iNFTnews | 国内NFT发展仅限于数字藏品吗?
猜你喜欢

Practical operation notes - notebook plus memory and ash cleaning

Punch smart spirit 1. The brand is attractive. What is the strength of the product?

VNC viewer remote connection raspberry pie without display

Mobile security tool jar

Use of JMeter easynmon

51单片机多机通信

JMeter socket connection sends data

2022安全员-C证考试模拟100题及在线模拟考试

Databinding quick start (still using findviewbyid?)

Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
随机推荐
Go语言运算符(第8课下)
2022 crane driver (limited to bridge crane) examination question bank simulated examination platform operation
Kubernetes 架构核心组件工作原理解析
Realization of MNIST handwritten numeral recognition
Garbage collection of C closure
Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
ros(25):rqt_ image_ View reports an error unable to load plugin for transport 'compressed', error string
Solution to network access packet loss of Tencent cloud international ECS
Usage of assert
最新QQ微信域名防红PHP程序源码+强制跳转打开
智能合约安全审计入门篇 —— delegatecall (2)
Leetcode 1248. Statistics of "graceful subarray" (harm, suddenly found that it can only enumerate violently)
adb shell sendevent
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
移动安全工具-jar
[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem
Encryption and encoding resolution
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
2022年起重机司机(限桥式起重机)考试题库模拟考试平台操作
I brush the question I - copy the linked list with random pointer