Zum Hauptinhalt springen
ProdukteDesktop-WerkzeugeTASTECADZeichnungsprüfungTASTEFILESDateiverwaltungTASTEFTPDateiübertragungTASTESSHRemote-ArbeitsbereichTASTEZIPKomprimieren und EntpackenTASTEWINMDateiverwaltungEntwicklerwerkzeugeTASTECODEIntegrierte Entwicklungsumgebung für RustTASTESTUDIOIntegrierte Entwicklungs- und TestumgebungTASTEETLDatenintegration (ETL)ServerTASTEREMOTERemote-Desktop-ServerTASTEGEOGeodatenserverTASTEMAILE-Mail-ArbeitsbereichInvestierenTASTESTOCKDesktop-App für automatischen AktienhandelErste SchritteDownloadsDokumentationKaufenAlle Produkte
Marktplatz
Neuigkeiten
TechnikNeuigkeitenEntwickler-News von heuteEntwicklerdokuProgrammiersprachenRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp- & Desktop-FrameworksTauriFlutterReact NativeElectronAlgorithmenAlgorithmus-GrundlagenKernalgorithmenFortgeschrittene AlgorithmenAlgorithmen für die Praxis
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcaseCommunity-Leitfaden
ZusammenarbeitWissenstransferWebsite-AufbauDesktop-App-AufbauRelease- und ZahlungspipelineVertriebspartnerKontakt
DiensteRemote-DesktopIndividuelle Installationspakete
TASTEDEV
Produkte

Desktop-Werkzeuge

TASTECADKomplexe Zeichnungen, mühelos geöffnetTASTEFILESNur die Dateien, die zählen – in BestzeitTASTEFTPDer aufgeräumteste Weg für Ihre DateienTASTESSHDie stärkere Verbindung zu Ihren ServernTASTEZIPSchneller packen, sicherer entpackenTASTEWINMEin tastaturorientierter Dateimanager mit zwei Fenstern

Entwicklerwerkzeuge

TASTECODERust-Apps bearbeiten, bauen, debuggen und testen – alles in einem FensterTASTESTUDIOVom Bearbeiten bis zu Remote-Tests und freigegebenen KI-KorrekturenTASTEETLDaten bewegen, die Werte im Blick

Server

TASTEREMOTEEin Remote-Desktop auf Ihrem eigenen ServerTASTEGEOEin GeoServer-kompatibler Geodatenserver, neu aufgebaut in RustTASTEMAILIhre E-Mail wieder in Ihrer Hand

Investieren

TASTESTOCKAutomatischer Aktienhandel nach Ihren Regeln: wann und was

Erste Schritte

DownloadsNeueste Versionen aller ProdukteDokuSo nutzen Sie jedes ProduktKaufenAbos und DauerlizenzenAlle ProdukteAlle Produkte im Überblick
Alle Produkte
MarktplatzNeuigkeiten
Technik

Neuigkeiten

Entwickler-News von heuteOffizielle Meldungen zu Sprachen, Frameworks, GitHub und KIEntwicklerdokuAnleitungen zu Sprachen, Frameworks und Algorithmen

Programmiersprachen

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App- & Desktop-FrameworksTauriFlutterReact NativeElectron

Algorithmen

Algorithmus-GrundlagenKomplexitätsanalyse · Sortieren · Suchen · Grundlegende Datenstrukturen · Bäume und HeapsKernalgorithmenGraphtraversierung · Kürzeste Wege und minimale Spannbäume · Dynamische Programmierung · Greedy-Algorithmen · Teile und herrsche · BacktrackingFortgeschrittene AlgorithmenZeichenkettenalgorithmen · Mathematik und Zahlentheorie · Bitmanipulation · Segmentbäume · Union-FindAlgorithmen für die PraxisStrategie für Coding-Interviews · LRU-Cache · Rate Limiting · Konsistentes Hashing
Alle Entwicklungsdokumente
Community
ProjekteEntwickler und Projekte entdeckenEntwicklungslogsEntscheidungen und ErkenntnissePromptsWiederverwendbare AnweisungenProbleme mit KI-ToolsProbleme und Workarounds für Claude, Codex, GeminiShowcaseFertige ErgebnisseCommunity-LeitfadenWie wir offen entwickeln
Zusammenarbeit
WissenstransferNative Apps mit Rust und eguiWebsite-Aufbau10 Sprachen, Konten, Dokumentation und DownloadsDesktop-App-AufbauRust und egui, ohne WebViewRelease- und ZahlungspipelineSignatur, MSI, deb, rpm, AppImage, PrüfsummenVertriebspartnerEmpfehlen und 30 % erhaltenKontaktEntwicklung, Partnerschaft, Investition
Dienste
Remote-DesktopIhren Computer im Browser erreichenIndividuelle InstallationspaketeNur nötige Funktionen, Einstellungen vorab
Kaufen
DE
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Anmelden
Anmelden
TASTEDEV

Von kleinen Werkzeugen zu besserer Entwicklung.

support@tastedev.netTASTEDEV unterstützen
ProdukteProduktübersichtKaufenDokuDownloadsMarktplatzSupport
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcase
RichtlinienÜber unsDatenschutzerklärungNutzungsbedingungenAbo-BedingungenRückerstattungCommunity-Richtlinien
KontoAnmeldenRegistrieren
Besucher
Heute
Gestern
Aufrufe gesamt
Firma
GXSOFT
Vertretungsberechtigt
CHOI YOUNG GU
Handelsregisternummer
853-44-00368
Anschrift
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefon
+82-10-4404-1523
E-Mail
whitecalvin@tastedev.net
Datenschutzbeauftragter
CHOI YOUNG GU

© 2026 TASTEDEVProduktinformationen basieren auf verifizierten Entwicklungsquellen.Veröffentlicht · wird verbessert

Kotlin-Dokumentation
Kotlin
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts
Diskussionen

Kotlin-Anleitung · 4/6

Modules and Packages

Dieses Kapitel ist vorerst nur auf Englisch verfügbar.

As a program grows, you split it into files and packages and pull in third-party libraries. This chapter covers packages and imports, visibility, adding dependencies with Gradle, and a short look at Kotlin Multiplatform.

Declaring a package

The package line at the top of a file sets the namespace for everything in it. Unlike Java, one file may hold several classes, and functions and properties can live at the top level, outside any class.

// src/main/kotlin/com/example/shop/Order.kt
package com.example.shop

data class Order(val id: Long, val amount: Int)

fun totalOf(orders: List<Order>): Int = orders.sumOf { it.amount }

const val FREE_SHIPPING_MIN = 50

Kotlin does not require directories to mirror package names, but the official style guide recommends it. A file without a package line belongs to the unnamed default package.

Imports

import brings in declarations from other packages: classes, but also top-level functions and properties. Resolve name clashes with an alias via as.

package com.example.app

import com.example.shop.Order
import com.example.shop.totalOf
import com.example.shop.FREE_SHIPPING_MIN
import com.example.legacy.Order as LegacyOrder
import java.time.LocalDate

fun main() {
    val orders = listOf(Order(1, 30), Order(2, 42))
    val total = totalOf(orders)
    println("${LocalDate.now()} total: $total")
    println("Free shipping: ${total >= FREE_SHIPPING_MIN}")
}

Star imports such as import com.example.shop.* also work. Several packages are imported by default, including kotlin.*, kotlin.collections.*, kotlin.text.*, kotlin.io.* and kotlin.ranges.*, plus java.lang.* on the JVM. That is why listOf and println need no import.

Visibility modifiers

ModifierTop-level declarationClass member
public (default)visible everywherevisible everywhere
internalsame modulesame module
protectednot allowedclass and subclasses
privatesame fileinside the class

Declarations are public unless you say otherwise. A module is a set of files compiled together, typically one Gradle module (strictly, one of its source sets). When writing a library, mark implementation details so they stay out of the public API.

Fragen zu diesem Kapitel?
Vorheriges KapitelTypes and DataNächstes KapitelErrors and Testing
internal

Adding dependencies with Gradle

Most Kotlin libraries are published to Maven Central and identified by group:artifact:version coordinates. Current Gradle projects usually keep versions in a version catalog. Replace each x.y.z below with the version you actually want.

# gradle/libs.versions.toml
[versions]
kotlin = "x.y.z"
coroutines = "x.y.z"

[libraries]
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
// build.gradle.kts
plugins {
    alias(libs.plugins.kotlin.jvm)
}

repositories {
    mavenCentral()
}

dependencies {
    implementation(libs.kotlinx.coroutines.core)          // from the catalog
    implementation("com.squareup.okhttp3:okhttp:x.y.z")   // raw coordinates
    testImplementation(kotlin("test"))
}

implementation is for dependencies needed to compile and run, testImplementation for test-only ones, and runtimeOnly for those needed only at run time. Browse libraries and their latest versions on Maven Central, and run ./gradlew dependencies to see the resolved dependency tree.

Multi-module builds

Larger projects are split into several Gradle modules. Register them in settings.gradle.kts, then depend on one module from another.

// settings.gradle.kts
rootProject.name = "shop"
include(":core", ":app")

// inside the dependencies block of app/build.gradle.kts:
// implementation(project(":core"))

Now internal declarations in core are invisible to app, so the compiler enforces the boundary between them.

Kotlin Multiplatform

Kotlin Multiplatform (KMP) shares code across the JVM, Android, iOS (via Kotlin/Native), the browser (Kotlin/JS and Kotlin/Wasm) and more. Shared code lives in the commonMain source set, platform code in sets such as jvmMain or iosMain. Common code declares an API with expect, and each platform supplies an actual implementation.

// commonMain
expect fun platformName(): String

fun greeting() = "Hello from ${platformName()}"

// jvmMain
actual fun platformName(): String = "JVM"

You can share only business logic and build native UIs per platform, or share the UI as well with Compose Multiplatform. When learning, start with a plain JVM project and explore KMP once you need it.

Summary

  • package sets the namespace; one file can hold many classes and top-level functions.
  • import works for classes and top-level functions alike, and as adds an alias.
  • Visibility defaults to public; internal limits a declaration to its module.
  • Add dependencies in the dependencies block of build.gradle.kts, by coordinates or through a version catalog, usually from Maven Central.
  • Kotlin Multiplatform shares code across platforms, using expect/actual for platform-specific parts.

0 Kommentare

Top-KommentareNeueste zuerst

Anmelden · Melde dich an, um einen Kommentar zu schreiben.