July 2017
Intermediate to advanced
796 pages
18h 55m
English
In Java, you can only import packages at the top of your code file, right after the packages statement. The situation is not the same in Scala; you can write your import statements almost anywhere inside your source file (for example, you can even write your import statements inside a class or a method). You just need to pay attention to the scope of your import statement, because it inherits the same scope of the members of your class or local variables inside your method. The _ (underscore) in Scala is used for wildcard imports, which is similar to the * (asterisk) that you would use in java:
// Import everything from the package math import math._
You may also use these { } to indicate a set of imports from the same parent ...
Read now
Unlock full access