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

Data Class

fun main(args: Array<String>) { 
    val book: Book = Book("Kotlin", "TutorialPoint.com", 5) 
    println("Name of the Book is--"+book.name) // "Kotlin" 
    println("Puclisher Name--"+book.publisher) // "TutorialPoint.com" 
    println("Review of the book is--"+book.reviewScore) // 5 
    book.reviewScore = 7 
    println("Printing all the info all together--"+book.toString()) //using inbuilt function of the data class  
    println("Example of the HasCode function--"+book.hashCode())   
}  
data class Book(val name: String, val publisher: String, var reviewScore: Int) 

Advertisements
Loading...

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