
Java : Strings, Text Blocks and Dates
Oddly Yogi · 13 thg 11, 2026
Mô tả
Text and dates are everywhere in real programs, and both hide traps. In this video we work with Java's String API: immutability, strip, substring, indexOf, split and join, why == and equals give different answers, StringBuilder for building text in loops, formatted output, and text blocks for multi-line text. Then we meet java.time: LocalDate, Period and ChronoUnit for due dates, DateTimeFormatter and parsing errors, ZonedDateTime and a real daylight-saving surprise, Duration, time zones, and a fixed Clock that makes 'today' repeatable. Like a library's date stamp, a due date is printed once and never changes. Shelf gets a Loan record that works out due dates and capped late fines, and prints a receipt from a text block.
Versions: Java 25 LTS (Eclipse Temurin 25.0.5).
In this chapter:
00:00 Printed labels and date stamps
01:27 Strings never change
02:35 Searching and slicing text
03:33 Comparing Strings: == or equals?
04:48 Splitting, joining and repeating
05:39 StringBuilder
06:31 Formatted text
07:15 Text blocks
08:40 Sorting text and converting numbers
10:02 Dates with java.time
11:14 Periods and month ends
12:05 Formatting and parsing dates
13:19 Time zones, daylight saving and Duration
14:57 A Clock that holds still
15:49 A Loan record with a due date
17:14 A receipt from a text block
19:20 Wrap up
This is Chapter 5 of 15 in the "Java" series.
#Java #Java25 #Programming #LearnJava #JavaTime