JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Success stories
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Absolute and relative paths

    Kotlin SELF
    42 level,0 lecture
    We break down how an absolute path differs from a relative one, why “file not found” almost always means the wrong working directory, how to see the real address in Kotlin/JVM via absolutePath, and how to build paths neatly without string concatenation (via File(parent, child)). At the end, there’s a short checklist of common mistakes and diagnostics.
    Open
  • File and Path: checks, directories, building a path from parts

    Kotlin SELF
    42 level,1 lecture
    We break down why it’s better to store a path not as a String, but as File/ Path objects: how to diagnose relative and absolute paths via path/ absolutePath, what checks to do before I/O ( exists(), isFile, isDirectory), how to prepare directories for writing via parentFile and mkdirs(), and how to assemble a path from parts via File(parent, child) and Path.of(...) without manually concatenating slashes.
    Open
  • Reading text: readText, readLines, forEachLine

    Kotlin SELF
    42 level,2 lecture
    We break down three basic ways to read text files in Kotlin/JVM: get the whole file as a String via readText(), load lines into a List<String> via readLines(), or process the file as a stream line by line via forEachLine { ... }. We compare convenience and memory cost, show practical examples (parsing, searching, counting), and point out common mistakes.
    Open
  • Writing text: writeText and appendText

    Kotlin SELF
    42 level,3 lecture
    We break down writing text files in Kotlin/JVM via java.io.File: how writeText() (full overwrite) differs from appendText() (append to the end), why you need to add the newline "\n" manually, how to create folders in advance via parentFile ?. mkdirs(), and how to neatly organize report and log code in a small console application.
    Open
  • use {} for I/O: closing files correctly

    Kotlin SELF
    42 level,4 lecture
    Let’s break down why I/O resources (files, streams, reader/writer) must always be closed, how to guarantee closing via try/ finally, and why the idiomatic way in Kotlin is use { ... }. In practice: reading via bufferedReader(), writing via bufferedWriter(), lazy lines via useLines { ... }, and typical mistakes that lead to “dangling” handles and partially written data.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success stories
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush