Skip to main content
1 of 12
erluxman
  • 19.6k
  • 22
  • 101
  • 129

1. Define : method inside internal object in any .kt file

 internal object HelloWorld { fun sayhelloWorld() = println("Hello World") } 

2. Use :

 HelloWorld.sayhelloWorld() 

3. Output:

 "Hello World" 
erluxman
  • 19.6k
  • 22
  • 101
  • 129