You are developing a simple Kotlin application that asks the user for their name and prints out a greeting message to them. This functionality is neatly bundled into a function named 'greetUser'. However, some parts of the function code are missing as represented by the placeholder symbol '▭'. Your task is to fill the blanks in the code to ensure that the function correctly retrieves the user's input and includes it in the greeting message printed to the standard output.
Standard input with Java Scanner
Creating a function to greet user by their name
Report a typo
Fill in the gaps with the relevant elements
import java.util.
fun greetUser() {
val reader = Scanner(System.`in`)
("Please enter your name:")
val name = reader.()
println("Hello, $name!")
}
fun main() {
greetUser()
}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.