From the An Overview of the Scala Programming Language, Second Edition:
// Scala
object PrintOptions {
def main(args: Array[String]): Unit = {
System.out.println("Options selected:")
for (val arg <- args)
if (arg.startsWith("-"))
System.out.println(" " + arg.substring(1))
}
}
In the example above, the Scala program invokes methods
startsWith
andsubstring
ofString
, which is a class defined in Java. It also accesses the staticout
field of the Java classSystem
, and invokes its (overloaded)println
method. This is possible even though Scala does not have a concept of static class members. In fact, every Java class is seen in Scala as two entities, a class containing all dynamic members and a singleton object, containing all static members.
I understand translation of Scala's companion objects into Java bytecode, but I am not sure what exactly does it means bold text in upper blockquote "is seen in Scala" for opposite example (from Java to Scala).
Does it mean that Java classes with static members are actually converted or just interpreted as two entities in Scala? Or both of my assumptions are wrong?