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



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

Answer / Sushant Panigrahi

The default access modifier in Scala for classes, objects, and members is `package private`, which means they are accessible within the package only. However, for methods, constructors, and fields declared outside of any class or object, the default access level is `public`. Yes, Scala does have a 'public' keyword, but it is used to explicitly declare that a member should be accessible from everywhere, including other packages.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Scala Interview Questions

What is Scala?

1 Answers  


Explain extractors in scala?

1 Answers  


What is scala trait?

1 Answers  


What is implicit class in scala?

1 Answers  


What are the advantages of case class?

1 Answers  


What is listset in scala collection?

1 Answers  


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

1 Answers  


Mention the advantages of scala?

1 Answers  


What is the difference between :: and #:: in scala?

1 Answers  


What is call-by-name? Does Scala and Java support call-by-name? What is the difference between call-by-value and call-by-name function parameters?

1 Answers  


What do you understand by tail recursion in scala ?

1 Answers  


Explain exception handling in scala?

1 Answers  


Categories