1.kotlin基础:数据类型

2020-04-16  本文已影响0人  LewisZhu

1.Boolean

val bl: Boolean = true

2.基本类型

Screen Shot 2020-04-15 at 11.14.02 PM.png
val along: Long = 123
val aInt: Int = 123

val aFloat: Float = 123.0F
val aDouble: Double = 123.0

//不可隐式转换  必须显示转换
val aLong: Long = aInt.toLong()

3.字符和字符串

Screen Shot 2020-04-16 at 12.06.21 AM.png
val aChar: Char = ‘a’
val cChar: Char = \u000f'  //Unicode
Screen Shot 2020-04-16 at 12.11.38 AM.png

4.数组

Screen Shot 2020-04-16 at 12.52.47 AM.png

5.类和对象

1>.注意:可以在类名后面直接写构造方法的参数

Screen Shot 2020-04-16 at 12.25.51 AM.png

2>.智能类型转换(Parent is Child)


Screen Shot 2020-04-16 at 12.33.17 AM.png

6.包 package 和 区间

1>包

Screen Shot 2020-04-16 at 12.42.40 AM.png Screen Shot 2020-04-16 at 12.40.51 AM.png

2>.区间


Screen Shot 2020-04-16 at 12.48.07 AM.png
上一篇 下一篇

猜你喜欢

热点阅读