Essential Scala
2019-04-26 (Fri) · 141 words

2 式、型、値

scala> :type 2
Int

評価

scala> "Hello World!"
res0: String = Hello World!
scala> "Hello World!".toUpperCase
res1: String = HELLO WORLD!

コンパイル

オブジェクト

中置記法

リテラル式

オブジェクトリテラル

scala> object Test {}
defined object Test  // 定義される

scala> Test // 評価する
res4: Test.type = Test$@4b038836 //

フィールド&メソッド

scala> Test7 Evaluating simpleFiled res0: Test7.type = Test7$@481763b6

scala> Test7.simpleField res1: Int = 42

scala> Test7.noParameterMethod Evaluating noParameterMethod res2: Int = 42

scala> Test7.noParameterMethod Evaluating noParameterMethod res3: Int = 42


```scala


Top     back     Posts     Tags     About Me