- # Scala 数据类型
- ## 1. 数值类型
- ### 1.1 与 Java 一样 Scala 也有 8 种数值类型
- * Byte
- * Char
- * Short
- * Int
- * Long
- * Float
- * Double
- * Boolean
- ### 1.2 其它数值类型
- * BigInt = java.math.BigInteger
- * Decimal = java.math.BigDecimal
- ### 1.3 用法
- * 1.4.toInt => 1
- * 99.toChar => c
- * 'A'.toInt => 65
- ### 1.4 操作符
- a + b => a.+(b)
- * \+
- * \-
- * \*
- * \/* \%
- * \&
- * \|
- * \^
- * \>>
- * \<<
- * +=
- * -=
- ### 1.5 函数和方法
* __方法和对象相关, 函数和对象无关.__
* 方法:
- def method(age: Int): Unit = {
- println("Your age is" + age + ".")
- }
- http://www.cnblogs.com/nowgood/p/scalastartup.html#_nav_3
来源: http://www.bubuko.com/infodetail-2567980.html