Absolute value

Report a typo

Choose the correct option to initialize the second declaration with the absolute value of -5.

a)

fun main() {
    val negativeFive = -5
    val positiveFive = Math.abs.-5 
}

b)

fun main() {
    val negativeFive = -5
    val positiveFive = Math.abs(negativeFive)
}

c)

fun main() {
    val negativeFive = -5
    val positiveFive = negativeFive(Math.abs)
}
Select one option from the list
___

Create a free account to access the full topic