/*  Notes on Scala for Java Programmers
    Scala IntegerReference Program

12345678901234567890123456789012345678901234567890123456789012345678901234567890

2019-01-29: Reconstructed from ScalaForJava.md notes source file
2019-02-01: Replaced string + with string interpolation
2022-02-25: Updated to be compatible with Scala 3 (procedures)

*/

class Reference[T] {
    private var contents: T = _
    def set(value: T) { contents = value }
    def get: T = contents
}

object IntegerReference {
    def main(args: Array[String]): Unit = {
        val cell = new Reference[Int]
        cell.set(13)
        println(s"Reference contains the half ${cell.get * 2}") 
    }
}
