We break down why, for file operations in Kotlin, you can’t rely only on checks like
exists() and why you still need
try/
catch around real I/O. We learn to make a “narrow”
try around
readText()/
writeText(), use
try as an expression, choose a function contract (
T?,
Boolean, or rethrowing
IOException), write useful error messages, order multiple
catch blocks correctly, and close resources via
use {}.