開発環境
- OS X El Capitan - Apple (OS)
- Emacs (Text Editor)
- Scala (プログラミング言語)
Learning Scala: Practical Functional Programming for the JVM (Jason Swartz (著)、O'Reilly Media)のPart 2. (Object-Oriented Scala)、Chapter 8.(Classes)、Exercises 1-a.(No. 3847)を解いてみる。
その他参考書籍
Exercises 1-a.(No. 3847)
コード(Emacs)
import java.util.Date
class Console(val make:String, val model:String, val debut:Date,
val wifi_type:Option[String], val formats:List[String], val resolution:Int) {
override def toString = s"make: $make, model: $model, debut: $debut, " +
s"wifi type: $wifi_type, formats: $formats, resolution: $resolution"
}
val c = new Console("make0", "model0", new Date(), Option("b/g"),
List("format0", "format1"), 10)
println(c)
入出力結果(Terminal, REPL(Read, Eval, Print, Loop))
$ scala-2.11 sample1_a.scala make: make0, model: model0, debut: Wed Jan 13 16:39:15 JST 2016, wifi type: Some(b/g), formats: List(format0, format1), resolution: 10 $
0 コメント:
コメントを投稿