Demonstrate how to get the size of a variable.

See also: Host introspection

// version 1.1.2
 
fun main(args: Array<String>) {
   /* sizes for variables of the primitive types (except Boolean which is JVM dependent) */
   println("A  Byte   variable occupies:  ${java.lang.Byte.SIZE / 8} byte")
   println("A  Short  variable occupies:  ${java.lang.Short.SIZE / 8} bytes")
   println("An Int    variable occupies:  ${java.lang.Integer.SIZE / 8} bytes")
   println("A  Long   variable occupies:  ${java.lang.Long.SIZE / 8} bytes")
   println("A  Float  variable occupies:  ${java.lang.Float.SIZE / 8} bytes")
   println("A  Double variable occupies:  ${java.lang.Double.SIZE / 8} bytes")
   println("A  Char   variable occupies:  ${java.lang.Character.SIZE / 8} bytes")
}