COMPARISON BETWEEN JAVA AND KOTLIN Programming Language
Since Kotlin was announced as official supported language for android development in Google I/O , many developers are wondering if they should stick with java or move to Kotlin . Kotlin was available but developers should use dependency plugin or use library . According to Google I/O , kotlin will be added in android studio 3.0 and later by default .
Kotlin and Java both are good on their own . Both runs on JVM . Programmers say Kotlin is easier to learn and apply than Java.
Kotlin Is Now Officially Supported Language For Android Development
There are many issues in Java that Kotlin has fixed . Some issues are :-
- Null references are controlled by the type system.
- No raw types
- Arrays in Kotlin are invariant
- Kotlin has proper function types, as opposed to Java’s SAM-conversions
- Use-site variance without wildcards
- Kotlin does not have checked exceptions
Though , Kotlin is new language and has fixed many issues of Java , It lacks many features too . Some includes :-
- Checked Exception
- Primitive types that are not classes
- Static members
- Non-private fields
- Wildcard Types
Now , let’s talk about the main topic , why kotlin is so good that google pushed Java back and brought Kotlin . As I already mentioned , Kotlin has fixed some really tough features that java suffers . It has brought many other features too which makes it more featured than Java .Some features that Kotlin has and Java does not are :-
- Lambda Expression and inline functions
- Extension Functions
- Smart Casts
- String templates
- Primary Constructors
- First-Class delegation
- Type inference for variable and property types
- Declaration-site variance & Type projections
- Range expressions
- Operator overloading
- Companion objects
- Data classes
- Separate interfaces for read-only and mutable collections
So, I hope you figured out why google is supporting kotlin . You might have got clear explanation if you should learn kotlin and work with it or not .
What does it look like?
Concise, simple and very easy to read (and write)
Semicolons are optional
If you liked this article , please don’t forget to share with your friends and if you have any question or advice , leave a comment below .