1 / 26

https://fabiomsr.github.io/from-java-to-kotlin/

Java vs Kotlin Syntax. Java final int x; final int y = 1; int w; int z = 2; z = 3; w = 1;. Kotlin val x: Int val y = 1 var w: Int var z = 2 z = 3 w = 1. https://fabiomsr.github.io/from-java-to-kotlin/. Bits Operations. Java

longk
Télécharger la présentation

https://fabiomsr.github.io/from-java-to-kotlin/

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java vs Kotlin Syntax Java final int x; final int y = 1; int w; int z = 2; z = 3; w = 1; Kotlin val x: Int val y = 1 var w: Int var z = 2 z = 3 w = 1 https://fabiomsr.github.io/from-java-to-kotlin/

  2. Bits Operations Java final intandResult = a & b; final intorResult = a | b; final intxorResult = a ^ b; final intrightShift = a >> 2; final intleftShift = a << 2; Kotlin valandResult = a and b valorResult = a or b valxorResult = a xor b valrightShift = a shr 2 valleftShift = a shl 2 Is As In Java if(x instanceof Integer){ } final String text = (String) other; if(x >= 0 && x <= 10 ){} Kotlin if (x is Int) { } val text = other as String if (x in 0..10) { }

  3. Null Safety Kotlin val name: String? = null varlastName: String? lastName = null varfirstName: String firstName = null // Compilation error!! Java final String name = null; String lastName; lastName = null val length = b!!.length

  4. Model Class in Java

  5. Model/Data Class in Kotlin

  6. Let’s do some fun :D

  7. Extensions Feature

  8. Smart Casting

  9. More Features

  10. More Features

  11. Some Awesome stuffs Some Awesome stuffs https://kotlinlang.org/docs/tutorials/ https://try.kotlinlang.org/#/Kotlin%20Koans/Introduction/Hello,%20world!/Task.kt https://blog.mindorks.com/a-complete-guide-to-learn-kotlin-for-android-development-b1e5d23cc2d8 https://android-arsenal.com/tag/205?sort=created https://fabiomsr.github.io/from-java-to-kotlin/

More Related