Given the type-alias type Cal = java.util.Calendar
how can the static
getInstance
method be accessed? I tried the following in Scala REPL:
You can't.
Yes, import java.util.{Calendar => Cal}
is really your best bet.
Conceptually, Scala object
members are similar to static members of Java classes. This might suggest the following would work, but it doesn't since there are actually no singleton objects available for Java classes.
scala> val Cal = java.util.Calendar
<console>:13: error: object Calendar is not a value
val Cal = java.util.Calendar
^