Samuel / Bocutiu | Programming Kotlin | E-Book | www.sack.de
E-Book

E-Book, Englisch, 420 Seiten

Samuel / Bocutiu Programming Kotlin

Get to grips quickly with the best Java alternative
1. Auflage 2025
ISBN: 978-1-78712-265-9
Verlag: De Gruyter
Format: PDF
Kopierschutz: Adobe DRM (»Systemvoraussetzungen)

Get to grips quickly with the best Java alternative

E-Book, Englisch, 420 Seiten

ISBN: 978-1-78712-265-9
Verlag: De Gruyter
Format: PDF
Kopierschutz: Adobe DRM (»Systemvoraussetzungen)



Quickly learn the fundamentals of the Kotlin language and see it in action on the web. Easy to follow and covering the full set of programming features, this book will get you fluent in Kotlin for Android.

Samuel / Bocutiu Programming Kotlin jetzt bestellen!

Weitere Infos & Material


Mixing Kotlin and Java in a project


Using different languages within the same project is quite common; I came across projects where a mix of Java and Scala files formed the code base. Could we do the same with Kotlin? Absolutely. Let's work on the project created earlier, . You should see the following directory structure in your IntelliJ (the standard template for a Java/Kotlin project):

Project layout

You can place Java code within the folder. Add a new package to the folder with the same name as the one present in the  folder: . Create a New | Java class named and use this code for the purpose of the exercise:

public class CarManufacturer { private final String name; public CarManufacturer(String name) { this.name = name; } public String getName() { return name; } }

What if you want to add a Java class under the subfolder? Let's create a class similar to the previous one and provide a field name for simplicity:

public class Student { private final String name; public Student(String name) { this.name = name; } public String getName() { return name; } }

In the function, let's instantiate our classes:

fun main(args: Array



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.