Sign in using Google or Yahoo! id.  

Scala: Referencing the .class object

 Comments Share:   Twitter   Reddit   HackerNews   Facebook 

Often in Java we use the .class object. For example:

InputStream is = MyClass.class.
    getResourceAsStream("org/wiztools/logo.gif");

To get the instance from Scala:

val is: InputStream = classOf[MyClass].
    getResourceAsStream("org/wiztools/logo.gif")
Posted on March 01, 2010 03:08 PM by Subhash Chandran
scala
blog comments powered by Disqus