Smart device, are you there?

Report a typo

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.

Fill in the gaps with the relevant elements
(: , : ) {
     {
        ("")
    }
    fun toggleConnection() {
        isConnected = !isConnected
        println("$deviceName connection status: $isConnected")
    }
}
String$deviceName initialized. Connection status: $isConnectedinitBooleanprivate var isConnectedclass SmartDeviceprintlnprivate val deviceName

Create a free account to access the full topic