📁 I/O, Files & Networking
12 Java concepts, each explained step by step with real code, a common trap and practice questions.
- Byte streams vs character streamsInputStream/OutputStream vs Reader/Writer.
- BufferingBufferedReader/Writer, why unbuffered I/O is slow, flush.
- Charsets & encodingUTF-8, StandardCharsets, platform default pitfalls.
- Path & Files (NIO.2)Path.of, Files.readString, readAllLines, lines, write, exists, walk.
- Closing resourcestry-with-resources for files and streams; Files.lines must be closed.
- File I/O exceptionsIOException, NoSuchFileException, UncheckedIOException.
- SerializationSerializable, transient, serialVersionUID, and deserialization security risks.
- Console & standard streamsSystem.in/out/err, BufferedReader vs Scanner performance.
- HttpClientJava 11+ HTTP client: sync send, sendAsync, BodyHandlers.
- Sockets basicsSocket/ServerSocket, client-server model, blocking I/O.
- NIO channels & buffersByteBuffer, channels, non-blocking I/O and selectors at a high level.
- Working with JSONNo JSON in the JDK; Jackson/Gson concepts of mapping objects.