Just finished working through the 2nd Edition Kotlin Programming book and have to say it was excellent. Every code sample in the book worked as described (although in a few cases I had to check the author’s source code against my own and found the problem to always be in my own code).
Was using IntelliJ IDEA 2021.2 while working through the book and just updated to 2021.3. I noticed that “Application” under JVM is now gone (which is what most of the book used). For future JVM type projects should I just use “Console Application” or select “Native Application” under Multiplatform?
Not a big deal, just curious…
Glad to hear you enjoyed the book!
The template we use for the majority of the book has indeed been removed in an update to IntelliJ. The closest option in that list is the “Console Application” option under the “JVM” header. The big difference between that template and the one used by the book is that the “Console Application” starts out with a main function and a few print statements. If you’re following along with the book, you can delete the contents of the Main.kt file that generates and follow the rest of the steps as they’re written. Same goes for any projects you make outside of the book — you can either choose to remove the provided main function or keep it if you’re happy with the code it includes.
Also, for a bit more detail, the big difference between the “Console Application” template under “JVM” and the “Native Application” template under “Multiplatform” is going to be which platform your code targets. “Console Application” will use Kotlin/JVM, which is the target used throughout the book up until Chapter 24. “Native Application”, meanwhile, will use Kotlin/Native. Kotlin/JVM applications have access to Java’s large library of APIs, and is often a bit easier to work with than Kotlin/Native. Also, Kotlin/JVM code runs wherever Java code runs, whereas Kotlin/Native applications need to be mindful of each target you want to support.
I hope that helps!
Just got the Kotlin 2nd edition and installed the latest IntelliJ IDEA CE and noticed the change. I chose Console Application for the first project as it was under the JVM category. This clears it up. I guess you learn the language basics before getting into using it for Android or web apps.