val age:Int){ STUDNET1(firstName = "tarou", lastName = "tanaka", age = 10), STUDNET2(firstName = "jirou", lastName = "suzuki", age = 12) } print(Student.STUDNET1.firstName) // tarou print(Student.STUDNET2.firstName) // jirou print(Student.STUDNET1.toString()) // STUDNET1 // SwiftͱҟͳΔϙΠϯτ2. ྻڍܕఆͷར༻ʹΑΓfilterforeach͕͑Δ Student.values().forEach { student -> print(student.firstName) } kotlinʹ͓͚ΔenumclassͰ͋ΔͷͰɺෳͷॳظΛ࣋ͬͨΓ
Java४ڌͳͷͰͰ͖Δ͜ͱ͕ଟ͍˕ ࢀߟ: https://dogwood008.github.io/kotlin-web-site-ja/docs/reference/enum-classes.html