0

我正在尝试创建具有姓名和特征的人员列表。我怎么能这样做?

class Player(val name: String, val nachname: String, val nr: Int)

// And I'm trying to do this:

fun main() {
    val team2 = mutableListOf<Player>()
    team2.add("Max", "Mustermann", 12)
 
    println("${team2.size}")
}
4

1 回答 1

1

您正在寻找

team2.add(Player("Max", "Mustermann",12))
于 2021-08-21T14:25:23.947 回答