Scala Language Packages Packages and files


Example

The package clause is not directly binded with the file where it is found. It is possible to find common elements of the package clause in diferent files. For example, the package clauses bellow can be found in the file math1.scala and in the file math2.scala.

File math1.scala

package org {
    package math {
        package statistics {
            class Interval
        }    
    }
}

File math2.scala

package org {
    package math{
        package probability {
            class Density
        }
    }
}

File study.scala

import org.math.probability.Density
import org.math.statistics.Interval

object Study {

    def main(args: Array[String]): Unit = {
        var a = new Interval()
        var b = new Density()
    }
}