Operators keyword
as
Cast expression — equivalent to Java (Type) expr.
expr as Type casts a reference. Casts chain left-to-right: a as A as B becomes ((B)((A) a)) in Java.
Affogato
example.aff
let obj: Object = "hello"
let s = obj as String
println(s.toUpperCase()) Generated Java
Example.java
Object obj = "hello";
String s = ((String) obj);
System.out.println(s.toUpperCase()); Related
is— Type test — equivalent to Java instanceof.