Kotlin Tutorials - midhunam0469/Tutorials GitHub Wiki
Kotlin is concise and expressive. Kotlin maintains a good compatibility with existing Java stack. Kotlin could be written along side Java. Existing Java classes could be converted to Kotlin files or classes.
Topics
- Set up IDE for Kotlin development - IntelliJ IDEA is the best IDE to start developing Kotlin Applications.
- HelloWorld Basic Kotlin Program - A basic program to get you started with Kotlin.
- main function in Kotlin - main function is the entry point to any Kotlin application. It can receive arguments.
- Kotlin Class & Kotlin Constructors - Kotlin Class, Kotlin Constructor, Kotlin Primary Constructor, Kotlin Secondary Constructor, Kotlin init block - Kotlin supports both procedural and object oriented programming. Kotlin provides classes and constructors.
- Data Classes - Classes intended only to store data. Kotlin makes the code concise for by implementing getters, setters, equals(), toString() implicitly.
- Loops - In Kotlin we can use loop statements like for, while, do-while like in other most programming languages.
- when expression - When expression in kotlin is an alternate to switch-case, but the variable if declared Any type, can handle any data type. The code looks concise, clear and pretty.
- Extension Functions - A class could be extended in its functionality and the function can be used throughout the Kotlin application.
- Null Safety - There are no checked exceptions in Kotlin and Kotlin provides an extra care to handle NullPointerException thrown.
- Primary constructor call expected
- Value must be initialized
- Handle Kotlin Error - Null cannot be a value of a non-null type
- Reading content of File
- Writing content to File
- Append text to File
- Copy file to other location
- Connect to MySQL using JDBC