The problem is that you created an Android project, here the "launch point of your application" is in the method onCreate()of the Activity defined as "LAUNCHER" inside your AndroidManifest.xml, this is where you could define the printing of the text.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
println("Hello world")
}
or as you are doing, define the class and call the function main()that would print the text:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
main()
}
If you want to create a Kotlin application I suggest you install Intellij IDEA as you did and create your application in this way by defining Applicationor Console Application:
The problem is that you created an Android project, here the "launch point of your application" is in the method
onCreate()
of the Activity defined as "LAUNCHER" inside yourAndroidManifest.xml
, this is where you could define the printing of the text.or as you are doing, define the class and call the function
main()
that would print the text:If you want to create a Kotlin application I suggest you install Intellij IDEA as you did and create your application in this way by defining
Application
orConsole Application
:I also suggest you use the Kotlin playground