/** * PAss a reference in Kotlin * identityHashCode might given memory location -- sort of. * Kotlin does not allow changing the reference location of passed param * so the line "pss = "5" "is commented out to make the program compile * * @author gtowell * Created: August 2021 */ fun main() { var aa: String = "asdf" println("Maina: ${aa} ${System.identityHashCode(aa)}") passer(aa) println("Mainb: ${aa} ${System.identityHashCode(aa)}") } fun passer(pss: String) { println("PASSa: ${pss} ${System.identityHashCode(pss)}") // pss = "5" // NOT allowed -- parameters are vals in Kotlin println("PASSb: ${pss} ${System.identityHashCode(pss)}") }