mohan babu mohan babu - 5 months ago 60
Scala Question

What is the significance of "Object" Keyword in Scala?

I am a novice in Scala. I am trying to code in Scala, Below is the syntax of how a program starts:

Object demo

//do your stuff..............


What is the Significance of that?? Is it like mother of all the classes defined???

Any help would be helpful.


class is a definition, a description. It defines a type in terms of methods and composition of other types.

An object is a singleton -- an instance of a class which is guaranteed to be unique. For every object in the code, an anonymous class is created, which nherits from whatever classes you declared object to implement. This class cannot be seen from Scala source code -- though you can get at it through reflection.