✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Que produit le code suivant ?
class Abeille(val nom: String, val espece: String) {
init {
require(this.espece in arrayOf("Apis mellifera", "Bombus")) {
"Espèce non connue." }
}
}
fun main() {
try {
val z = Abeille("Zoé", "Frelon")
println("OK")
} catch (e: IllegalArgumentException) {
println("INVALIDE")
}
}