Public access modifier (public)

Methods, variables, constructors, and structures declared public can be accessed freely from outside the declaring class. A public class existing in a different package from an accessing class must be imported before it can be used. The following class makes use of the public access modifier:

public class Person { .. }

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.