Created
December 13, 2019 15:52
-
-
Save labibmuhajir/86852ec05d6d5b7ff7b8b509e6068838 to your computer and use it in GitHub Desktop.
example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You can edit, run, and share this code. | |
* play.kotlinlang.org | |
*/ | |
fun main() { | |
val siswa1 = Siswa(Modules.nama) | |
val siswa2 = Siswa(Modules.module.get("nama"), Modules.module.get("kelas")) | |
println("siswa 1 nama: " + siswa1.nama) | |
println("siswa 2 kelas: " + siswa2.kelas) | |
} | |
object Modules{ | |
val nama = "Budi" | |
val module = mapOf<String, String>( | |
"nama" to "Budi", | |
"kelas" to "9" | |
) | |
} | |
data class Siswa(val nama: String? = null, val kelas: String? = null) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment