Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the use of 'object' keyword in Scala? How to create Singleton objects in Scala?



What is the use of 'object' keyword in Scala? How to create Singleton objects in Scala?..

Answer / Vishakha Dutt

The 'object' keyword in Scala is used to declare a singleton object, which is an object that can have only one instance. To create a singleton object in Scala, you simply define it using the 'object' keyword without creating any constructor or methods.nnHere is an example:n```scalanobject SingletonObject {n val someValue: String = "Hello World"n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Scala Interview Questions

What is a constructor in scala?

1 Answers  


What is Range in Scala? How to create a Range in Scala?

1 Answers  


What are the major advantages of Scala Language? Are there any drawbacks of Scala Language?

1 Answers  


Explain the access modifiers available in scala?

1 Answers  


Differentiate nil, null, none, and nothing in scala.

1 Answers  


Explain how scala is both functional and object-oriented programming language?

1 Answers  


Explain different types of identifiers in scala?

1 Answers  


What is the current latest version of Scala?

1 Answers  


Difference between Array and List in Scala?

1 Answers  


What is the use of ‘???’ in Scala-based Applications?

1 Answers  


Give some examples of packages in scala?

1 Answers  


Does scala and java support call-by-name?

1 Answers  


Categories