Created
August 16, 2019 14:40
-
-
Save rail-rate/32ff44ec6c8d48c6b027813c7429723e to your computer and use it in GitHub Desktop.
try-catch6
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 text = "abcde" | |
sub1(text) | |
} | |
fun sub1(a : String){ | |
sub2(a) | |
} | |
fun sub2(a : String){ | |
try{ | |
val number = a.toInt() | |
println("number = ${number}") | |
}catch(e : NumberFormatException){ | |
println("sub2で処理") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment