I have started playing with Scala so my code is a bit Java-ish. Below is my code :
object TypeParam extends App{
class Param1[T](val elem: T*){
val elems : List[T] = elem.toList
def toPrint(): Unit ={
elems.foreach(print)
}
}
@Override
def main(args : List[String]): Unit ={
val x= new Param1[Int](1,2,3,4,6,7)
x.toPrint()
}
}
what I am expecting is to get the elements printed but in realty I am not getting any output.
I know that I can print a list easily through forEach but for learning I am trying to blend things up.
Could anyone explain why I am not getting any output,so in scala do we not have class level variable which can be set ?