Your current task is to work on a simple Hello World program in Kotlin. The major part of the code is already written, however, there are a few gaps that you need to fill. The first gap is to define an object. Secondly, within the scope of this object, you need to declare a string variable. Lastly, fill the gap for outputting the variable in a line to the console. Can you complete the program and make it print 'Hello, Kotlin!'?
Objects and their properties
Completing a simple Hello World program
Report a typo
Fill in the gaps with the relevant elements
main(args: Array<String>) {
val myObject = {
myVariable: String = "Hello, Kotlin!"
fun printVariable() {
(myVariable)
}
}
myObject.printVariable()
} ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.