// A parametric list: class List[T](elem: T, next: List[T]) { def printList(): Unit = { println(elem) if (next!=null) next.printList() } }