To check types we use is as an operator. It is similar to the instanceof operator in Java. But this type check is way smarter than Java.
The following Java code forces us to do type casting even if we have a condition for an instanceof check:
View view; if(view instanceof Button){ ((Button) view).setText("Some text"); }
Why double the work? Take a look at the Kotlin is operator. It automatically resolves all button functions for the view object. Now that's called a smart language:
val view: View if (view is Button) { view.text = "Some text" }