if99.net

IF99 ITB

Archive for the ‘scala type system’ Category

? Representation of class in Scala

without comments

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.

Representation of class in Scala originally appeared on firdau.si on January 27, 2011.

Written by nanda

January 27th, 2011 at 4:30 pm