From Java to Kotlin: life without static
TL; DR Java developers new to Kotlin are often confused by the lack of static members. Which options Kotlin provides in order to replace the static keyword? Let's summarize for easy reference:
Java static… Replace with… void main() Top-level function Constants Top-level constants Methods in utility class Top-level functions Factory methods Companion object functions Private methods Private companion object functions or private top-level functions in same file Singleton accessors Object instance Continue reading for the details.
[Read More]