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

Test

class HelloWorld(val rno :Int,val name:String)
{
    val rno1:Int =rno;
    val name1:String=name;
    def display()
    {
        println("Roll No: "+rno+"\tName:"+name)
        
    }
    
}

class HelloWorld1(override val rno:Int,override val name:String, val department:String) extends HelloWorld(rno,name)
{
    val department1:String=department
    
    override def display()
    {
        
        println("Name: "+name+"\tRno:"+rno+"\tDepartment:"+department1)
    }
}






object HelloWorld
{
    def main(args:Array[String])
    {
        
        val h1=new HelloWorld1(1,"Frayosh","IDA")
        h1.display()
    }
    
    
}

Advertisements
Loading...

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