- Kotlin Tutorial
- Kotlin - Home
- Kotlin - Overview
- Kotlin - Environment Setup
- Kotlin - Architecture
- Kotlin - Basic Syntax
- Kotlin - Comments
- Kotlin - Keywords
- Kotlin - Variables
- Kotlin - Data Types
- Kotlin - Operators
- Kotlin - Booleans
- Kotlin - Strings
- Kotlin - Arrays
- Kotlin - Ranges
- Kotlin - Functions
- Kotlin Control Flow
- Kotlin - Control Flow
- Kotlin - if...Else Expression
- Kotlin - When Expression
- Kotlin - For Loop
- Kotlin - While Loop
- Kotlin - Break and Continue
- Kotlin Collections
- Kotlin - Collections
- Kotlin - Lists
- Kotlin - Sets
- Kotlin - Maps
- Kotlin Objects and Classes
- Kotlin - Class and Objects
- Kotlin - Constructors
- Kotlin - Inheritance
- Kotlin - Abstract Classes
- Kotlin - Interface
- Kotlin - Visibility Control
- Kotlin - Extension
- Kotlin - Data Classes
- Kotlin - Sealed Class
- Kotlin - Generics
- Kotlin - Delegation
- Kotlin - Destructuring Declarations
- Kotlin - Exception Handling
- Kotlin Useful Resources
- Kotlin - Quick Guide
- Kotlin - Useful Resources
- Kotlin - Discussion
Kotlin - Architecture
Kotlin is a programming language and has its own architecture to allocate memory and produce a quality output to the end user.
Following are the different scenarios where Kotlin compiler will work differently.
Compile Kotlin into bytecode which can run on JVM. This bytecode is exactly equal to the byte code generated by the Java .class file.
Whenever Kotlin targets JavaScript, the Kotlin compiler converts the .kt file into ES5.1 and generates a compatible code for JavaScript.
Kotlin compiler is capable of creating platform basis compatible codes via LLVM.
Kotlin Multiplatform Mobile (KMM) is used to create multiplatform mobile applications with code shared between Android and iOS.
Whenever two byte coded files ( Two different programs from Kotlin and Java) runs on the JVM, they can communicate with each other and this is how an interoperable feature is established in Kotlin for Java.
Kotlin Native
Kotlin/Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine. Kotlin/Native supports the following platforms:
macOS
iOS, tvOS, watchOS
Linux
Windows (MinGW)
Android NDK
Many more...
Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible, for example, embedded devices or iOS.
It is easy to include a compiled Kotlin code into existing projects written in C, C++, Swift, Objective-C, and other languages.
Quiz Time (Interview & Exams Preparation)
Answer : A
Explanation
Yes, Kotlin compiler can convert the .kt file into ES5.1 and generates a compatible code for JavaScript.
Q 2 - Compiled Kotlin code can be included in which of the following language code?
Answer : D
Explanation
It is easy to include a compiled Kotlin code into existing projects written in C, C++, Swift, Objective-C, and other languages.