Scala - Source File

Card Puncher Data Processing


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.

Discover More
Card Puncher Data Processing
Scala - Compiler (scalac)

The scala compiler compiles .scala source files to .class files, like the Java compiler. The scalac command compiles one (or more) Scala source file(s) and generates Java bytecode which can be...

Share this page:
Follow us:
Task Runner