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...


How do we make a call to a private primary constructor in scala?



How do we make a call to a private primary constructor in scala?..

Answer / Kumar Gaurav

In Scala, you cannot directly call a private primary constructor. You should create an object companion that defines the application's entry point and use it instead.nExample:n```scalanclass MyClass private(val data: Int)nobject MyClass{n def apply(data: Int): MyClass = new MyClass(data)n}nMyClass(10)n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Scala Interview Questions

Is Scala Statically-Typed Language?

1 Answers  


What is 'Type Inference' in Scala?

1 Answers  


Explain que with example?

1 Answers  


Popular clients who are using Play and Scala to develop their applications?

1 Answers  


What is the default Unit and Functional Testing Framework for Play? What is the default Build Tool for Play? What is the Default Template Engine for Play? What is the built-in Web Server available in Play Framework?

1 Answers  


How can you format a string?

1 Answers  


What does sortedset in scala collection?

1 Answers  


List the advantages of using scala over other functional programming languages.

1 Answers  


What square measure the Scala variables?

1 Answers  


What is a companion object in scala?

1 Answers  


What is traversable in scala collection?

1 Answers  


What is the utilization of tuples in scala?

1 Answers  


Categories