Sonntag, 29. April 2012

How Scala sees java classes?

How Scala sees java classes?

excerpted from : An Overview of the Scala Programming Language, Second Edition

1. Scala has object definitions (starting with object) besides class definitions. An object definition defines a class with a single instance -- this is sometimes called a singleton object. 

2.  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. Hence, System.out is accessible in Scala as a member of the object System.

Keine Kommentare: