5.7 C
New York
Thursday, November 14, 2024

Kotlin for Java builders | InfoWorld



Add the next dependency to the dependencies part of /app/construct.gradle.kts:


implementation("com.google.code.gson:gson:2.9.1")

This lets us deal with the JSON we’ll get again from the API. Now, if we run the app we’ll see some details about Chewbacca:


$ ./gradlew run

> Job :app:run
Identify: Chewbacca
Top: 228
Hair shade: null
Eye shade: null

BUILD SUCCESSFUL in 2s

Conclusion

The fantastic thing about Kotlin for Java builders is that it suits pretty simply into your present psychological mannequin. Kotlin permits you to program contained in the JVM, with all its intensive optimization and huge ecosystem, however with a purposeful language that’s in some methods “extra Java than Java,” but straightforward to know and highly effective. You too can use Kotlin alongside Java, so that you don’t have to decide on one or the opposite.

There’s much more to Kotlin, together with an extension operate (which helps you to add class features with out subclasses), coroutines, extra purposeful capabilities, lack of checked exceptions, and a simplified strategy to object-oriented programming. We’ll proceed exploring Kotlin and its options in my subsequent article.



Supply hyperlink

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles