Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute Scala Online

object TestElseIFDemo
{
	def main(args:Array[String])
	{
	var (x,y,z)=(Integer.parseInt(args(0)),Integer.parseInt(args(1)),Integer.parseInt(args(2)))
	if(x>y && y>z)
		print(" biggest value is"+x)
	else if(y>z)
		print("biggest value is"+y)
	else
		print("biggest value is"+z)
	}
}

Compile and Execute Scala Online

object TestElseIFDemo
{
	def main(args:Array[String])
	{
	var (x,y,z)=(Integer.parseInt(args(0)),Integer.parseInt(args(1)),Integer.parseInt(args(2)))
	if(x>y && y>z)
		print(" biggest value is"+x)
	else if(y>z)
		print("biggest value is"+y)
	else
		print("biggest value is"+z)
	}
}


Compile and Execute Scala Online

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world!")
      
      var x: Int = 5
      println("x is: "+x)
     
      val p: Double = 3.14
      println("p is "+p)
    
      var a: Int = 4
      var b:Int = 6
      var result = add(a, b)
      println(a+"+"+b+"="+result)
      
   }
   
   def add (x: Int, y: Int): Int = {
       x+y
   }
   
}

function as variables

object HelloWorld {
   def main(args: Array[String]) {
       delayed(time());
       def time() = {
           println("Getting time in nano seconds")
           42
       }
       def delayed( t: => Long ) = {
           println("In delayed method")
           println("Param: " + t)
       }
   }
}

MyScala

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world!")
   }
}

LearnScala

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world!")
   }
}

Compile and Execute Scala Online

class Customer(CustNo:Int, CustName:String, Balance:Double){
    def this(a:Int,b:String){
        this(a,b,100.5)
    }
    
    def this(a:Int){
        this(a,"Mac", 200.6)
    }
    
    def this(){
        this(124, "Stev", 500.6)
    }
    
    
    def show(){
        println("CustNo: " + CustNo + " CustName: " + CustName + " Banance: " + Balance)
    }
}

object HelloWorld{
    def main(args:Array[String]){
        var c1 = new Customer(501,"Rajesh")
        c1.show()
        var c2 = new Customer(502)
        c2.show()
        var c3 = new Customer()
        c3.show()
    }
}

test

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world!")
   }
}

val st = "hello"
st.

trythisnewscalaproject123456789

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world!")
   }
}

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

object HelloWorld {
   def main(args: Array[String]) {
      println("Hello, world")
   }
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.