Packages and Imports
Package Basics
Declare a package at the top of a file.
Package Basics
PackageBasics.scala
package shop.billing
object Main {
def main(args: Array[String]): Unit = {
val price =
val tax = price / 10
val total = price + tax
println("price=" + price)
println("total=" + total)
}
}
package shop.billing
object Main {
def main(args: Array[String]): Unit = {
val price =
val tax = price / 10
val total = price + tax
println("price=" + price)
println("total=" + total)
}
}
package shop.billing
object Main {
def main(args: Array[String]): Unit = {
val price =
val tax = price / 10
val total = price + tax
println("price=" + price)
println("total=" + total)
}
}
package-basics
A `package` declaration groups related code under a name. The code inside runs the same way; the package just organizes where it lives.