Scala is a modern programming language for the Java Virtual Machine (JVM) that combines the best features of object-oriented and functional programming languages. Using Scala, you can write programs more concisely than in Java, as well as leverage the full power of concurrency. Since Scala runs on the JVM, it can access any Java library and is interoperable with Java frameworks. Scala for the Impatient concisely shows developers what Scala can do and how to do it. In this book, Cay Horstmann, the principal author of the international best-selling Core Java(t), offers a rapid, code-based introduction that's completely practical. Horstmann introduces Scala concepts and techniques in "blog-sized" chunks that you can quickly master and apply. Hands-on activities guide you through well-defined stages of competency, from basic to expert. Coverage includes * Getting started quickly with Scala's interpreter, syntax, tools, and unique idioms * Mastering core language features: functions, arrays, maps, tuples, packages, imports, exception handling, and more * Becoming familiar with object-oriented programming in Scala: classes, inheritance, and traits * Using Scala for real-world programming tasks: working with files, regular expressions, and XML * Working with higher-order functions and the powerful Scala collections library * Leveraging Scala's powerful pattern matching and case classes * Creating concurrent programs with Scala actors * Implementing domain-specific languages * Understanding the Scala type system * Applying advanced "power tools" such as annotations, implicits, and delimited continuations Scala is rapidly reaching a tipping point that will reshape the experience of programming. This book will help object-oriented programmers build on their existing skills, allowing them to immediately construct useful applications as they gradually master advanced programming techniques.
......(更多)
Cay S. Horstmann is principal author of Core Java™, Volumes I and II, Eighth Edition (Prentice Hall, 2008), as well as a dozen other books for professional programmers and computer science students. He is a professor of computer science at San Jose State University and a Java Champion.
......(更多)
......(更多)
更好的做法是使用字符串插值(string interpolation): print(f"Hello, $name! In six months, you'll be ${age + 0.5}%7.2f years old%n")
......(更多)