What is default access modifier in Scala?Does Scala have 'public' keyword?
Answer Posted / 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 View All Answers