Hadoop2.4.1
Scala 2.10.4
[Hello World] by script
1. Create scala file "Hello.scala" as follow:
object Hello{
def main(args: Array[String]) {
println("Hello")
}
}
2. Compile the scala filedef main(args: Array[String]) {
println("Hello")
}
}
- $ scalac Hello.scala
- It will create 2 files: Hello.class & Hello$.class
3. Execute(at the same dir with Hello.class)
[method 1]
- $ scala Hello.scala
[method 2]
- $ scala -cp . Hello
[Def]
- def : defines a method
- val : defines a fixed value (which cannot be modified)
- var : defines a variable (which can be modified)
沒有留言:
張貼留言