A: Preparation Tool
1:JAVAJDK 1.7.0_55 or more
: www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2:scala-2.10.4.msi more stable version
: Scala-lang.org/download, click the All Downloads button to download the required Scala version
3:scala Eclipse Development Tools
: scala-idea.org
II: Install and configure environment variables
1: Manual installation of Javajdk,scala-2.10.4.msi, Scala Eclipse tool decompression
2: Configure Javajdk,scala Environment variables (by default, install JAVAJDK and Scala, computer----> Right-click Properties----> Advanced system Settings----> select advanced----> Click environment Variables----> System variable (S) column Select path and double-click into edit path, where you can view Javajdk,scala environment variables, if there is no environment variables, you need to configure this.
Three: Start Helloscala
1: Open Scala Eclipse development tool, File----> Right-click New---->scala Project----> Write project name----> Click Finish button
2: Expand Project location to src----> right-click New---->package, enter package name: Com.scala.hello
3: New object, navigate to package name----> right-click New---->scala Object, this is the new OK, the following demo
Package Com.scala.hello
Object Helloscala {
def main (args:array[string]): Unit = {
println ("Hello,scala")
}
}
Object It is a companion object in Scala, in object: All methods and properties are static
Unit: The meaning of a null value, does not return a value, you can put: Unit = Remove
Object Helloscala {
def main (args:array[string]) {
println ("Hello,scala")
}
}
Note: The end of the statement is added without semicolons;
Setting up a Scala environment under Windows