Scala - Source File


Scala source code is stored in text files with the extension .scala.

Typically Scala programmers create:

  • one source file for each class,
  • or one source file for a class hierarchy.

In fact, Scala allows multiple classes and objects to be defined in the same source file.



The name of a Scala source file can be chosen freely, but it is recommended to use the name of a class which is defined in that file.


The directory where the file resides follow the package hierarchy.

Powered by ComboStrap