Last active
June 29, 2019 11:27
-
-
Save rail-rate/87601a2471592d757171c2557fd5a4d5 to your computer and use it in GitHub Desktop.
型変換3
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