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

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • IOException and FileNotFoundException: error handling

    JAVA 25 SELF
    38 level,0 lecture
    How the I/O exceptions hierarchy in Java is structured, the difference between IOException and its subclass FileNotFoundException, when they occur, and how to handle them correctly. We will cover the order of catch blocks, hands-on file reading/writing, logging tips, as well as a brief table of the most frequent errors. We will touch on checked exceptions, the keywords try, catch, finally, throws, and the try-with-resources construct.
    Open
  • Checking for the existence of files and directories

    JAVA 25 SELF
    38 level,1 lecture
    How to check in Java whether a file or folder exists: the File class with its methods exists(), isFile(), isDirectory(), and the modern NIO approach via Path and Files — Files.exists(), Files.isRegularFile(), Files.isDirectory(). We will discuss the TOCTOU problem and why a pre-check does not replace error handling: even after exists() you can still get FileNotFoundException or AccessDeniedException, so always use try blocks and, when possible, try-with-resources. Plus hands-on practice: reading a file if present, creating a directory with Files.createDirectory() and Files.createDirectories(), working with relative and absolute paths.
    Open
  • Handling Corrupted Files, Data Recovery

    JAVA 25 SELF
    38 level,2 lecture
    How to recognize “broken” files by exceptions ( EOFException, MalformedInputException, ZipException, StreamCorruptedException), what to do when the format does not match, and which recovery strategies to use: logging and notifying the user, partial reading up to the error, backups, checksums ( SHA-256). Practice reading until EOF, correct handling of encodings, and analysis of common mistakes (validation, try-with-resources, careful overwrite).
    Open
  • Permissions and access to the file system

    JAVA 25 SELF
    38 level,3 lecture
    In this lecture we examine how the OS manages access rights (POSIX and ACL on Windows), why Java throws AccessDeniedException, how and when to use checks Files.isReadable(), Files.isWritable(), Files.isExecutable(), and why TOCTOU is dangerous. We show the “safe write” pattern: a temporary file plus an atomic move via StandardCopyOption.ATOMIC_MOVE, proper error handling with try- catch, and logging ( java.util.logging). Finally, there are practical tips and common mistakes.
    Open
  • Best Practices for Working with Files

    JAVA 25 SELF
    38 level,4 lecture
    A practical guide to reliable and secure work with the file system in Java: proper exception handling ( try/ catch, targeted responses to IOException, AccessDeniedException), careful use of the Files/ Path APIs and backups ( Files.copy with StandardCopyOption.REPLACE_EXISTING), temporary files ( Files.createTempFile), integrity checks ( MessageDigest.getInstance( "SHA-256")), as well as minimizing TOCTOU windows and using try-with-resources everywhere. You will learn why an empty catch is dangerous, how to work with permissions ( File.canRead()/ File.canWrite()), and what pitfalls relative paths like File( "data.txt") entail.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy