ScalaTutorial中文版.PDF

  1. 1、本文档共22页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
A Scala Tutorial for Java programmers Version 1.3 March 15, 2009 Michel Schinz, Philipp Haller PROGRAMMING METHODS LABORATORY EPFL SWITZERLAND 1 介绍 - Introduction 本文档是 Scala 语言和编译器的快速入门介绍,适合已经有一定编程经验,且希望了解 Scala 可以做什么的读者。我们假定本文的读者具有面向对象编程(Object-oriented programming,尤其是java 相关)的基础知识。 This document gives a quick introduction to the Scala language and compiler. It is intended for people who already have some programming experience and want an overview of what they can do with Scala. A basic knowledge of object-oriented programming, especially in Java, is assumed. 2 第一个例子 - A first example 我们使用最经典的“Hello world ”作为第一个例子,这个例子虽然并不是特别炫 (fascinating ),但它可以很好的展示Scala 的用法,且无须涉及太多的语言特性。示 例代码如下: As a first example, we will use the standard Hello world program. It is not very fascinatingbut makes it easy to demonstrate the use of the Scala tools without knowing too much about the language. Here is how it looks: object HelloWorld { def main(args: Array[String]) { println(Hello, world!) } } Java 程序员应该对示例代码的结构感到很熟悉:它包含一个 main 方法,其参数是一个 字符串数组,用来接收命令行参数;main 的方法体只有一句话,调用预定义的println 方法输出“Hello world !”问候语。main 方法不返回值(这是一个过程方法 procedure method),因此,该方法不必声明返回值类型。 The structure of this program should be familiar to Java programmers: it consists of one method called main which takes the command line arguments, an array of strings, as parameter; the body of this method consists of a single call to the predefined method println with th

文档评论(0)

shaofang00 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档