Hello. And welcome. In this lesson, you will learn about Kotlin compatibility with Java. Kotlin was developed with a purposeful relationship with Java and Android. In a nutshell, we can make an analogy that Kotlin is a direct descendant, a child of Java. Kotlin was created to interrupt fully with Java, which means that they can work together. This helps developers to keep their Java code, which is stable and structurally sound while simultaneously developing new features using Kotlin. So when we install an ID for Kotlin, we also added the JDK, the Java Development Kit, right along with it. That is because we need the Java foundation in order to run Kotlin. They are intertwined as mother and child. If your system has Java, then you can use Kotlin. Java can take Kotlin code and compile it correctly. And Kotlin can take Java code and compile it correctly. Look at this. If you wanna go with Kotlin 100%, then you can simply cut and paste your old Java code into a Kotlin file. Let me show you. Here's some Java code. So I'm gonna take all of this Java code right here, and I'm gonna copy it. Now, I'm gonna paste it into my Kotlin program. There it is. And look at this, the IDE automatically recognizes that this is Java code. And it's gonna help me to convert it to Kotlin code. Watch this. We have a pop-up call Convert Code From Java, and it saying, "The clipboard content seems to be Java code." Yeah, it is. "Do you wanna convert it to Kotlin?" Yeah, I sure did. So I'm gonna click Yes. And here we go. It's doing the conversion for me. And there it is. My Java code has been converted to Kotlin code, and I'm ready to go. So if your system is written in Java, then you can keep all of your Java code. But without any further investment to infrastructure, you can write all new applications in a language that's more productive. Kotlin reduces the number of lines of code by 40% compared to Java. That's according to JetBrains. So at no additional cost, you can be more productive by using Kotlin. Say you have a program written in Java, then in your IDE, your Java class compiler creates a .class file called bytecode. Now with Kotlin, the process is exactly the same, but your code is written in Kotlin. Then the Kotlin compiler will produce a file that is exactly the same as Java. Here's some similarities between Kotlin and Java. Kotlin uses Java libraries. The IDE provides Java APIs, and it integrates in the Java frameworks. Andrey Breslav of JetBrain says, quote, "Kotlin relies on Java libraries. "We make them better, mostly through extensions. "This gets us compatibility "while keeping the language clean," unquote. So both Java and Kotlin are statically type. Meaning that if a variable is known at compile time, such as an integer or a string variable, then your IDE can warn you if there's a problem. And your ID can help you with the syntax. One key difference is extension functions. In Kotlin, you can extend the class with new functionality by prefixing the name of a class to the name of a new function, like you see in this example. I'm extending the function in Kotlin. So in Java, if we want to extend the functionality of our class, we need to create a whole new class. So extensions are not available in Java, but they are available in Kotlin. So that is our lesson on Kotlin compatibility with Java. Thank you for watching. Stay tuned for the next lesson. So let's go.