变量的声明

打开cmd,输入scala,进入交互模式

scala> val a = 123
a: Int = 123

scala> var s = "java"
s: String = java

scala> s = "scala"
s: String = scala

scala> s
res0: String = scala

scala> val a: Int = 123
a: Int = 123

scala> var s: String = "scala"
s: String = scala

你可能感兴趣的:(变量的声明)