Home »
Code Examples »
Scala Code Examples
Scala - how to import Java classes? Code Example
The code for how to import Java classes?
// import one class
import java.io.File
// import every class in a package
import java.io._
// import multiple classes from a package (version 1)
import java.io.{File, IOException, FileNotFoundException}
// import multiple classes from a package (version 2)
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
// create an alias to a class you import
import java.io.{File => JFile}