kotlin基础数据类型
//Number类型
//Double 64
//Float 32
//Long 64
//Int 32
//Short 16
//Byte 8
//运行在虚拟机中 长度和操作系统无关
val aInt:Int = 8//java int Integer合体 自动进行区分
val anotherInt:Int=0xFF
val moreInt:Int = 0b00000001
val maxInt:Int = Int.MAX_VALUE
val minInt:Int=Int.MIN_VALUE
val aLong:Long=12345632223223
val another:Long=123
val maxLong:Long = Long.MAX_VALUE
val minLong:Long = Long.MIN_VALUE
val aFloat:Float = 2.0f
val anotherFloat=1E3f
val maxFloat = Float.MAX_VALUE
val minFloat = -Float.MAX_VALUE
val aDouble:Double = 3.0//双精度浮点型
val maxDouble = Double.MAX_VALUE
val minDouble = -Double.MAX_VALUE
val aShort = 127
val maxShort = Short.MAX_VALUE//32767
val minShort = Short.MIN_VALUE//-32768
val byte:Byte = 127//-128-127
//Char对应java 中的Character类
//Char占两个字节 表示一个16位的unicode字符
//字符用单引号'' 例如'a' '/n'
val aChar:Char = '0'
val bChar:Char='中'
val cChar:Char='\u900f'//unicode编码
//转义字符
// \t制表符 \b回退符 \n回车 \r光标回到行首 \'单引号 \"双引号 \\反斜杠 \$美元符号
//$开头在kotlin 中是字符串模板
//不可以隐士转换
val errorInt:Int = 5
val aLong1:Long = errorInt.toLong()
//val aLong2:Long = errorInt //type mismatch
val aString:String = "hello"
val fromChars:String = String(charArrayOf('h','e','l','l','o'))
fun main(args:Array<String>){
println(anotherInt)
println(moreInt)
println(123L)
println(maxInt)
println(Math.pow(2.0,31.0)-1)
println(minInt)
println(-Math.pow(2.0,31.0))
println(maxLong)
print(Math.pow(2.0,63.0)-1)
println(minLong)
println(-Math.pow(2.0,63.0))
println(aFloat)
println(anotherFloat)
println(0/0.0f == Float.NaN)//返回false NaN不能比较
//Float.NaN
println(aChar+" "+ bChar+" "+ cChar)
println(aString == fromChars)//kotlin == 和 equals等价的
println(aString === fromChars)//对象引用值比较
println("输出:"+ aString)
val arg1:Int = 0
val arg2:Int = 1
println(""+arg1+" + "+arg2+" = "+(arg1+arg2))//java 字符串写法
println("$arg1 + $arg2 = ${arg1+arg2}")//kotlin模板写法
//
val sayHello:String = "Hello \"Trumph\""
println(sayHello)
println("\$$arg1")
val rawString:String = """//打印出来原始字符串 无法进行转义
\t
\n
\\\\$arg1
\\\\ $ arg1
"""
println(rawString.length)