score:96

Accepted answer
scala> Main.getClass
res1: java.lang.Class[_] = class Main$

score:9

Since Main is an object, for your example to work, simply replace your assignment line with;

private [this] val TAG = this.getClass.getName;

score:17

The reason why classOf[Main] doesn't work is because Main is not a type.

Classes and traits define types, objects do not.


Related Query