Wednesday, December 30, 2015

Language: Scala (1)......

Scala (Scalabale Language) is a Java-based, hybrid language that integrates features of object-oriented and functional languages. Its popular among application developers.
Here, every value is object and every function is a value.
So, every function is an object.
Migration between Scala and java is easy, as they share same run-time platform.
download Scala from
#HelloWorld as script
object HelloWorld {
     def main(args: Array[String]) {
      println("Hello, world!") // prints Hello World

scalac HelloWorld.scala
scala HelloWorld

Scala has about 50 keywords e.g. val, var
//One line comment
/*Multi-line comment*/

#Package declaration
package com.liftcode.stuff

#Package import
import scala.xml._

#Single class import from a Package
import scala.collection.mutable.HashMap

#Multiple class import from a Package
import scala.collection.immutable.{TreeMap, TreeSet}

#Script Test.scala
object Test {
   def main(args: Array[String]) {
      println("Hello\tWorld\n\n" );

#Execution of the above script
scalac Test.scala   
scala Test  

No comments:

Post a Comment