I study Java , I have never dealt with Kotlin , although I am planning in the near future. Now I Koltin trying to make out one pattern, an example of using the Android Architecture Components , which is written in Koltin 'e and ran into a syntax (it seems like a class), which I cannot understand.

Explain, pliz, what's here, what it is, (of the type MyDatabaseLiveData is a class that ... (what this type does after a colon), and LiveData<List<Article>>() is ...
With the override method, everything is clear here. Thank you very much!

 class MyDatabaseLiveData : LiveData<List<SomeClass>>() { override fun onActive() { super.onActive() ... } } 

I dare to suggest that this syntax is of type extends in java. So?

 class MyDatabaseLiveData extends LiveData<List<SomeClass>>() { @Override public void fun onActive() { super.onActive(); ... } } 

    1 answer 1

    Yes, your translation is correct.

    class MyDatabaseLiveData - public class MyDatabaseLiveData

    symbol : - replaces extends in java

    LiveData - parent class

    In Android studio, you can convert Kotlin to Java

     Menu > Tools > Kotlin > Decompile Kotlin to Java 
    • You can convert it, but only if the code itself is compiled without errors, otherwise this option is not available. Those. almost all project with all dependencies needs to be compiled. Easier to ask here. For which you and thank you! - Stanly T