Skip to content

Instantly share code, notes, and snippets.

@kalaiselvan369
Last active June 9, 2023 07:13
Show Gist options
  • Save kalaiselvan369/0b913eaa2681853558bbb742abe70328 to your computer and use it in GitHub Desktop.
Save kalaiselvan369/0b913eaa2681853558bbb742abe70328 to your computer and use it in GitHub Desktop.
Importance of package
package api
// since the class is declared as internal, it is accessible to all the packages
// that are declared inside the same module.
internal class ApiClient
package service
import api.ApiClient
class Service {
val client = ApiClient()
// we were able to access internal class ApiClient inside this class because
// the file Api.kt is present inside a package named api
// therefore with help of import keyword we were able to access
// the file, class or top level members from another package and reuse it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment