Update Scala基本数据类型和运算符.md

This commit is contained in:
heibaiying 2019-05-06 09:52:51 +08:00 committed by GitHub
parent 3a95e910c7
commit 2c4723c5da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,13 +165,13 @@ res15: Int = 3
Int类中包含了多个重载的`+`方法,用于分别接收不同类型的参数。
<div align="center"> <img width='700px' src="https://github.com/heibaiying/BigData-Notes/blob/master/pictures/scala-int+.png"/> </div>
<div align="center"> <img src="https://github.com/heibaiying/BigData-Notes/blob/master/pictures/scala-int+.png"/> </div>
### 3.2 运算符优先级
操作符的优先级如下:优先级由上至下,逐级递减。
<div align="center"> <img width='700px' src="https://github.com/heibaiying/BigData-Notes/blob/master/pictures/scala-操作符优先级.png"/> </div>
<div align="center"> <img src="https://github.com/heibaiying/BigData-Notes/blob/master/pictures/scala-操作符优先级.png"/> </div>
在表格中某个字符的优先级越高,那么以这个字符打头的方法就拥有更高的优先级。如`+`的优先级大于`<`,也就意味则`+`的优先级大于以`<`开头的`<<`,所以`2<<2+2` , 实际上等价于`2<<(2+2)` :
@ -212,4 +212,4 @@ res6: Boolean = true
## 参考资料
1. Martin Odersky(著),高宇翔(译) . Scala编程(第3版)[M] . 电子工业出版社 . 2018-1-1
1. Martin Odersky(著),高宇翔(译) . Scala编程(第3版)[M] . 电子工业出版社 . 2018-1-1