object wb{ def main(args:Array[String]){ println("Happy everyday!DATA-CENTER!") println(new java.util.Date()) }
object w{ def main(args:Array[String]){ println("Happy everyday!") } } ~ ~ ~
Scala集成了函数编程和对象编程的优点。
SEAMLESS JAVA INTEROP
Scala runs on the JVM, so Java and Scala stacks can be freely mixed for totally seamless integration.
TYPE INFERENCE
So the type system doesn’t feel so static. Don’t work for the type system. Let the type system work for you!
CONCURRENCY & DISTRIBUTION
Use data-parallel operations on collections, use actors for concurrency and distribution, or futures for asynchronous programming.
TRAITS
Combine the flexibility of Java-style interfaces with the power of classes. Think principled multiple-inheritance.
PATTERN MATCHING
Think “switch” on steroids. Match against class hierarchies, sequences, and more.
HIGHER-ORDER FUNCTIONS
Functions are first-class objects. Compose them with guaranteed type safety. Use them anywhere, pass them to anything.