Reputation: 8851
For example :
sealed class Event {
object ViewClicked : Event()
}
Should it be ViewClicked
or viewclicked
?
It seems its a variable , so i guess it should be viewclicked
but the rest of the codebase on the app has capitalized objects. So i wanted to know whats the right approach here?
Also , can anyone confirm if object
is like a static variable in Java?
Upvotes: 1
Views: 524
Reputation: 30755
ViewClicked
is not a variable. Declaring object ViewClicked
we show that we have only one instance (singleton) of class ViewClicked
, so it is definition of a class and creation of its instance on one line.
Names of classes and objects start with an upper case letter and use the camel case.
Therefore the correct definition would be:
sealed class Event {
object ViewClicked : Event()
}
Upvotes: 4