Kotlin - Data Types
How can you safely cast an
Any type to String in Kotlin without risking a ClassCastException?Any type to String in Kotlin without risking a ClassCastException?as? attempts to cast and returns null if it fails, avoiding exceptions.as throws exception if cast fails. toString() converts to string but not cast. is checks type but does not cast.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions