Tag: big data hadoop

Array in scala enter form keyboard

This is function scala programer enter N element Interger form keyboard. Example: import scala.io._ object InputArray { def main(args: Array[String]): Unit = { println("Please enter n all element?") val n = StdIn.readInt() println("---------begin--------") val IntArr = Array.fill(n.toInt) { StdIn.readInt() } println("---------result--------") for (x <- IntArr) { println("x:" + x) } } } Reuslt:

Advertisements

Type Parameter is Scala

Class in Scala can receive a special parameter type, called Type Parameter. This type of parameter is not the same as normal variables as other parameters, but a parameter that specifies the type. That's why it's called Type Parameter. While Class is defined, it is entirely possible to manipulate an unknown type (specified when calling … Continue reading Type Parameter is Scala