Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

13.2 Concise access to related code > 13.2 Concise access to related code - Pg. 238

C HAPTER 13 · Packages and Imports package bobsrockets.navigation class Navigator Listing 13.1 · Placing the contents of an entire file into a package. The package clause of Listing 13.1 places class Navigator into the package named bobsrockets.navigation . Presumably, this is the navi- gation software developed by Bob's Rockets, Inc. Note Because Scala code is part of the Java ecosystem, it is recommended to follow Java's reverse-domain-name convention for Scala packages that you release to the public. Thus, a better name for Navigator 's package might be com.bobsrockets.navigation . In this chapter, however, we'll leave off the " com. " to make the examples easier to understand. The other way you can place code into packages in Scala is more like C# namespaces. You follow a package clause by a section in curly braces that contains the definitions that go into the package. This syntax is called a