For example, an integer can not be assigned to a long variable. This does not compile: val x: Int = 20 val y: Long = x. You need to do an explicit casting: val x: Int = 20 val y: Long = x.toLong() Conclusion. These are some of the most outstanding differences you can find between variables in Java and Kotlin. App Vay Tiền.

difference between var and val