Representation of class in Scala

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:


You can read more about Scala Type System here.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.