The Artima Developer Community


Errata for Programming in Scala
Chapter 13: Packages and Imports
Return to errata index.

Page 247 (PDF page 278):
In the second sentence, the method name "canGetHome" in class Rocket
should be "canGoHomeAgain".

FIXED
Page 245 (PDF page 285):
It states on p245:

"...import the normal Java date class as simply Date..."

Shouldn't it be SDate?

If we do as suggested; eg:

import java.sql.{Date => SDate}

and add a method to a class; eg:

def sql(date: String) : Date = { Date.valueOf(date) }

we will get a compiler error.

However, if we use SDate the compiler is happy:

def sql(date: String) : SDate = { SDate.valueOf(date) }


PS. I find the inclusion of:

import java.sql.{Date => SDate}

in the text redundant as it adds nothing to the previous example of:

import Fruits.{Apple=>McIntosh,Orange}

after reading this example we now the => mapping syntax.

Page number: Book type: Paperback book PDF eBook
Book version: (Or build date. Found on back of title page.)
Your feedback:
Your name: (optional)
Your email address: (optional) (will not be published)

Copyright © 2021 Artima, Inc. All rights reserved.