Scala: Difference between file.class and file$.class from scalac -
When I use sclech to compile file.scala, then I get 2 outputs, file.class and file $ . What is the difference between these files and which is the right thing to do? I get different error messages between executing "scala file" vs "scala file $".
for classes ending in Scala object s in "$" Is compiled because you have the permission of the "normal" class with the same name but the methods of the object are also highlighted in the form of static methods of the "normal" class, so that they can be called under the names that you would expect. This slaya is a distortion of trying to present semantics in such a way that it helps to understand Java / JVM, and I encourage it to consider it as a description of an implementation instead of something important. (@MATPUTNAM) The answer is that anonymous classes, including closures, are compiled for class files with $ es on their name, but in this particular instance your file is $$ class The reason is not)
Use the scala file . If you are interested in the implementation details, then you java -cp /path/to/scala-library.jar file .
Comments
Post a Comment