当前位置:网站首页>Scala trait exercise
Scala trait exercise
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
object practice {
abstract class Coder {
var name: String = _
var age: Int = _
def eat(): Unit
// Skill
def skill(): Unit
}
class JavaCoder extends Coder {
override def eat(): Unit = println("Java Programmers eat cabbage , Rice porridge ")
override def skill(): Unit = println(" Master Java")
}
class PythonCode extends Coder {
override def eat(): Unit = println("Python Programmers eat cabbage , Eat rice porridge ")
override def skill(): Unit = println(" Master Python")
}
trait BigData {
def learningBigData(): Unit = {
println(" After the dark horse ")
println(" Mastered :Hadoop、Zookeeper、HBase、Hive、Spark、Flink etc. ")
println(" Project experience : Enterprise class 360° Full range of user portraits 、 Hundreds of billions of warehouses 、 Dark horse recommendation system 、 Telecommunication signal strength diagnosis ")
}
}
class PartJavaCode extends JavaCoder with BigData {
override def eat(): Unit = {
super.eat()
println(" Master Java + BigData The programmer , Eat beef , And beef soup ")
}
override def skill(): Unit = {
super.skill()
learningBigData()
}
}
class PartPythonCoder extends PythonCode with BigData {
override def eat(): Unit = {
super.eat()
println(" Master Python + BigData The programmer , Eat mutton , Drink mutton soup ")
}
override def skill(): Unit = {
super.skill()
learningBigData()
}
}
def main(args: Array[String]): Unit = {
println(" Ordinary Java The programmer ")
val jc = new JavaCoder
jc.name = " Xyy "
jc.age = 20
println(jc.name, jc.age)
jc.eat()
jc.skill()
println("-" * 20)
println(" Master Java + BigData The programmer ")
val pjc = new PartJavaCode
pjc.name = " Brother dark horse "
pjc.age = 30
println(pjc.name, pjc.age)
pjc.eat()
pjc.skill()
}
}
边栏推荐
- Source code analysis the problem that fragments cannot be displayed in the custom ViewGroup
- Basic summary of MySQL database knowledge
- 51单片机多机通信
- Golang示例续期锁:Redis+Channel+sync.Mutex
- [redis realizes seckill service ②] solution to oversold problem
- Registration method of native method in JNI
- The problem of multiple callback of video ads stimulated by applets (offcolse problem)
- 移动安全工具-dex2jar
- A small crawler program written by beginners
- Jar package merging using Apache ant
猜你喜欢

2022年危险化学品经营单位安全管理人员考试试题及模拟考试

【Redis实现秒杀业务②】超卖问题的解决方案

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

Use and click of multitypeadapter in recycleview

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

Apk slimming compression experience
![[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem](/img/01/5ec4e5dae1748dce3d5dee33a24b0b.png)
[redis realizes seckill business ③] specific implementation of optimistic lock for oversold problem
![[microservices sentinel] sentinel quick start | building an image | starting the console](/img/88/a01c8120f6117f1b8e4463cf6f685f.png)
[microservices sentinel] sentinel quick start | building an image | starting the console

Registration method of native method in JNI

Working principle analysis of kubernetes architecture core components
随机推荐
Infotnews | is the development of domestic NFT limited to digital collections?
实现mnist手写数字识别
Tiktok wallpaper applet source code
在企业级开发过程中我发现有位同事用select * from where 条件 for update
Introduction to smart contract security audit delegatecall (2)
Punch smart spirit 1. The brand is attractive. What is the strength of the product?
Helm chart warehouse operation
Usage of assert
Realization of MNIST handwritten numeral recognition
Go crawler framework -colly actual combat (III) -- panoramic cartoon picture capture and download
Uniapp encapsulated incentive advertisement, screen insert advertisement and banner advertisement
【Redis实现秒杀业务③】超卖问题之乐观锁具体实现
Garbage collection of C closure
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
Several ways for wechat applet to jump to the page are worth collecting
Kibana installation via kubernetes visual interface (rancher)
ros(24):error: invalid initialization of reference of type ‘xx’ from expression of type ‘xx’
Solution to network access packet loss of Tencent cloud international ECS
2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
2021-11-07