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

Give some examples of packages in scala?

1 Answers  


What is a tuple in scala?

1 Answers  


What is default access modifier in Scala?Does Scala have 'public' keyword?

1 Answers  


What are the popular MVC frameworks for Scala Language to develop Web Applications?

1 Answers  


List the default imports are available in scala language?

1 Answers  


What are streams in scala?

1 Answers  


Differentiate between null, nil, none and nothing?

1 Answers  


What do you mean by scala map?

1 Answers  


What is scala and why it is used?

1 Answers  


In Scala, Pattern Matching follows which Design Pattern? In Java, ‘isinstanceof’ operator follows which Design Pattern?

1 Answers  


What are the differences between Array and ArrayBuffer in Scala?

1 Answers  


How is the scala code compiled?

1 Answers  


Categories