What are the name equivalents and main differences between Java and Kotlin nested/inner/local classes?
These are the name equivalents:
| Kotlin | Java |
|-------------------|-------------------------------------------|
| Inner Classes | Non-Static Nested Classes / Inner Classes |
| Nested Classes | Static Nested Classes |
| Local Classes | Local Classes |
| Anonymous Objects | Anonymous Classes |
This is a quick overview of differences:
In Kotlin inner classes to reference the instance of the outer class, we need to use the qualifier this expression.
Some examples can be found over on this tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With