Created
June 29, 2019 11:30
-
-
Save rail-rate/ee2c54803d0a66b2f3d0d8b3977bc258 to your computer and use it in GitHub Desktop.
型変換4
This file contains 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
fun main(args: Array<String>) { | |
val ten : String = "10" | |
val a : Byte = ten.toByte() //Byte型に変換 | |
val b : Short = ten.toShort() //Short型に変換 | |
val c : Int = ten.toInt() //Int型に変換 | |
val d : Long = ten.toLong() //Long型に変換 | |
val e : Double = ten.toDouble() //Double型に変換 | |
val f : Float = ten.toFloat() //Float型に変換 | |
val g : String = ten.toString() //String型に変換 | |
println("Byte = " + a) | |
println("Short = " + b) | |
println("Int = " + c) | |
println("Long = " + d) | |
println("Double = " + e) | |
println("Float = " + f) | |
println("String = " + g) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment