logo

Crowdly

Browser

Add to Chrome

On considère la classe suivante (extrait simplifié) : class Abeille(val nom: S...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

On considère la classe suivante (extrait simplifié) :

class Abeille(val nom: String, val espece: String) {

var quantiteNectar = 0

fun butine(fleur: String): Int {

val quantite = fleur.length

print("${this.nom} a collecté $quantite mg de nectar. ")

this.quantiteNectar += quantite

return quantite

}

}

Quelle est la sortie du programme suivant ?

fun main() {

val m = Abeille("Maya", "Apis mellifera")

val w = Abeille("Willy", "Bombus")

m.butine("acacia")

w.butine("thym")

m.butine("tilleul")

println("${m.quantiteNectar} / ${w.quantiteNectar}")

}

0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.iut-tlse3.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome