Complete the code below to create a class SmartDevice with a primary constructor that takes the device name as the first parameter and the connection status as the second parameter. Inside the class, include an initializer block that prints the device information.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming basic
Constructors
Smart device, are you there?
Report a typo
Fill in the gaps with the relevant elements
(: , : ) {
{
("")
}
fun toggleConnection() {
isConnected = !isConnected
println("$deviceName connection status: $isConnected")
}
}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.