5
Can I be part of the code in Java and another part with Kotlin? Can anyone tell me?
5
Can I be part of the code in Java and another part with Kotlin? Can anyone tell me?
8
Yes, you can. It is a feature propagated by Google that the new Android language is interoperable with Java; you can create a class in Java and another in Kotlin, each one will be compiled to a file .class
, and one can call the other in the code (Kotlin call Java or Java call Kotlin).
You can even gradually adopt Kotlin in your Java code, that is, exchange a Java class for the same class written in Kotlin, and so on.
Examples:
I get it, thank you. That actually I started backwards, I studied Kotlin when it launched and now that I’m seeing the java syntax. But you answered my question already. Thank you.
No problem. If the answer answered you, you can accept it by clicking on the visa sign ( ) in the upper left corner of the answer, below the count of votes.
Browser other questions tagged java android-studio kotlin
You are not signed in. Login or sign up in order to post.
Hypothetically yes. Kotlin works on top of the JVM, so you can call things from Java in Kotlin
– Jefferson Quesado