Seems very simple but can be source of frustration. So, how to represent class in Scala?
In Java, you refer to a class by adding .class
at the end of the class name. In Scala, you get the equivalent of that by using classOf[]
.
An example for referring String class is as follow:
classOf[String]
You can read more about Scala Type System here.