计算机专业毕业设计外文翻译--面向Java开发人员的Scala指南类操作
《计算机专业毕业设计外文翻译--面向Java开发人员的Scala指南类操作》由会员分享,可在线阅读,更多相关《计算机专业毕业设计外文翻译--面向Java开发人员的Scala指南类操作(22页珍藏版)》请在毕设资料网上搜索。
1、 - 1 - 来自: think in java ( 3) 外文原文 The busy Java developers guide to Scala: Class action It makes sense for Java developers to use objects as a first point of reference for understanding Scala. In this second installment of The busy Java developers guide to Scala series, Ted Neward follows a basic p
2、remise of language measurement: that the power of a language can be measured in direct relation to its ability to integrate new facilities - in this case, support for complex numbers. Along the way youll see some interesting tidbits related to class definitions and usage in Scala. In last months art
3、icle , you saw just a touch of Scalas syntax, the bare minimum necessary to run a Scala program and observe some of its simpler features. The Hello World and Timer examples from that article let you see Scalas Application class, its syntax for method definitions and anonymous functions, just a glimp
4、se of an Array, and a bit on type-inferencing. Scala has a great deal more to offer, so this article investigates the intricacies of Scala coding. Scalas functional programming features are compelling, but theyre not the only reason Java developers should be interested in the language. In fact, Scal
5、a blends functional concepts and object orientation. In order to let the Java-cum-Scala programmer feel more at home, it makes sense to look at Scalas object features and see how they map over to Java linguistically. Bear in mind that there isnt a direct mapping for some of these features, or in som
6、e cases, the mapping is more of an analog than a direct parallel. But where the distinction is important, Ill point it out. Scala has class(es), too Rather than embark on a lengthy and abstract discussion of the class features that Scala supports, lets look at a definition for a class that might be
7、used to bring rational number support to the Scala platform (largely swiped from Scala By Example - see Resources): Listing 1. rational.scala class Rational(n:Int, d:Int) private def gcd(x:Int, y:Int): Int = if (x=0) y else if (x0) gcd(-x, y) else if (y0) -gcd(x, -y) - 2 - else gcd(y%x, x) private v
8、al g = gcd(n,d) val numer:Int = n/g val denom:Int = d/g def +(that:Rational) = new Rational(numer*that.denom + that.numer*denom, denom * that.denom) def -(that:Rational) = new Rational(numer * that.denom - that.numer * denom, denom * that.denom) def *(that:Rational) = new Rational(numer * that.numer
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 毕业设计 外文 翻译 面向 java 开发人员 scala 指南 操作
