Working together
This section will explore interoperability in action, i.e., we will see how Kotlin and Java can work together at a technical or code level.Let's create a project. The project doesn't need anything special; you just need to select Kotlin as the primary or default language. Here are the details I used to fill out the fields to create the project.
- Name: Interoperability
 - Location: The default location.
 - Language: Kotlin
 - Build system: Gradle
 - Java Development Kit: Java Corretto 17
 - Gradle Domain Specific Language: Kotlin
 
All the parameters are optional and can be modified, but the recommendation is to use the same ones to avoid different results.Now that we have the project created, let's create our first file with Kotlin. Inside the src/main/kotlin directory, we will create a file that will be our first Kotlin file. To easily recognize it, we will name the file Main, and its extension will be .kt.The file will be empty at first, but now we will create a function...