Unit1 Unit1 - 3 months ago 9
Scala Question

Scala : Significance of file generated with $ during compile

Please note that I am beginner to Scala. Can someone please explain what is the significance of the class file with $ in it.

-rw-r--r-- 1 rodiee staff 130 Aug 9 10:39 HelloWorld.scala

-rw-r--r-- 1 rodiee staff 586 Aug 9 10:40 HelloWorld.class

-rw-r--r-- 1 rodiee staff 635 Aug 9 10:40 HelloWorld$.class

Thanks
-Scala Beginner

Answer

The files ending with $ are jvm static classes related to the "singleton" objects in your .scala files

You can read this other answer for reference: Singletons as Synthetic classes in Scala?

Comments