Akshay Deshmukh
What are companion objects in Scala?
By Akshay Deshmukh in Open Source on Jan 25 2019
  • Laxmidhar Sahoo
    May, 2019 8

    Scala classes cannot have static variables or methods. Instead a Scala class can have what is called a singleton object, or sometime a companion object.A singleton object is declared using the object keyword

    • 0
  • Akshay Deshmukh
    Jan, 2019 25

    If a singleton object and class have same name then it is known as a Companion object. Campanion object and class should be defined in the same source file .

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS