Array initializing in Scala
Solution 1:
scala> val arr = Array("Hello","World")
arr: Array[java.lang.String] = Array(Hello, World)
Solution 2:
To initialize an array filled with zeros, you can use:
> Array.fill[Byte](5)(0)
Array(0, 0, 0, 0, 0)
This is equivalent to Java's new byte[5]
.