var x = 0 def IncreaseOne(): Int = { x += 1 x } def IncreaseOne() = { x += 1 x } def IncreaseOne = { x += 1 x } def IncreaseOne(): Unit = { x += 1 x } def IncreaseOne() { x += 1 x } def IncreaseOne = { x += 1 x } 上文中,前三个方法的定义是等同的,后三个也是等同的.规则非常简单,如果方法…