Loading…
Loading…
Language
Articles and problems tagged Java.
Building translatable sentences with java.text.MessageFormat: numbered placeholders with number, date and java.time styles, quoting rules, ChoiceFormat for counts and ranges and its limits for real plural rules, ListFormat (Java 22) and the list, compact and dtf pattern types added in Java 23.
Presenting dates in the user's language and calendar, parsing what users type, first day of the week, sorting strings correctly with Collator (strength, decomposition, collation keys, custom rules, locale extensions) and making equal text equal with java.text.Normalizer.
Formatting and parsing numbers for people in any locale: NumberFormat factories, compact numbers like 1.5M, lenient versus strict parsing (Java 23), DecimalFormat patterns and rounding, DecimalFormatSymbols, and the Currency class with locale extensions for accounting style.
What a java.util.Locale is and how to get one right: BCP 47 language tags with scripts, regions and Unicode extensions, Locale.of and Locale.Builder, the default locale and its DISPLAY and FORMAT categories, display names, the Turkish i, and matching user preferences with LanguageRange.
Turning java.time values into text and back: the predefined ISO formatters, localized styles and skeleton patterns, custom pattern letters and their traps (Y vs y, m vs M), resolver styles, DateTimeFormatterBuilder, and converting to and from Date, Calendar, TimeZone and java.sql types.
Times of day and time zones in java.time: LocalTime and LocalDateTime, ZoneId and the IANA database, converting between zones and instants, gaps and overlaps at daylight saving changes, ZoneRules, Duration versus Period across transitions, and when to use OffsetDateTime.
Work with dates without times or zones: creating and validating LocalDate values, month-end clamping in arithmetic, Period versus days, ages and differences, DayOfWeek and Month, TemporalAdjusters and custom adjusters, date streams, YearMonth, MonthDay, ISO weeks and other calendars.
How java.time models machine time: the Java time scale and leap seconds, Instant as a point counted from the epoch, Duration as exact seconds and nanoseconds, arithmetic, parsing and parts, Clock and InstantSource for testable code, and measuring elapsed time correctly.
How server applications manage database connections: why pools exist and how they work, HikariCP settings and pool sizing, pools with virtual threads, DataSources from JNDI, @Resource and Spring Boot, distributed transactions, and the persistence layers built on JDBC: JdbcClient, jOOQ and JPA.
Group statements into transactions with setAutoCommit, commit and rollback, choose isolation levels and understand dirty, non-repeatable and phantom reads, retry deadlocks, use save points, speed up bulk changes with batch updates, and map advanced SQL types like ARRAY, UUID, JSON and SQLXML.
Discover a database's structure and capabilities at run time: DatabaseMetaData for products, features, tables, columns, keys and indexes, ResultSetMetaData for the columns of any query, ParameterMetaData for statement parameters, and the JDBCType enum, with a generic table printer.
Work with data after closing the connection: RowSetProvider and RowSetFactory, populating a CachedRowSet, editing offline and writing back with acceptChanges, conflict handling with SyncResolver, paging, JdbcRowSet, WebRowSet XML, filtering, joining and listeners.
Request scrollable and updatable result sets with type and concurrency settings, move the cursor with previous, absolute, relative, first and last, edit, insert and delete rows through the result set, check what the driver really granted, and know when SQL or pagination queries are better.
Store and read large binary and text data with Blob, Clob and streams, use JDBC escape syntax for dates, functions, outer joins, LIKE and stored procedure calls with CallableStatement, process multiple results with getMoreResults, and retrieve auto-generated keys.
Use PreparedStatement for every SQL statement with variable values: ? placeholders and setter methods, reuse and statement caching, dates, NULLs, IN lists and LIKE patterns, how SQL injection works and why parameters stop it, whitelisting identifiers, and the enquote helpers.
Run SQL with Statement: executeUpdate, executeQuery and execute, reading ResultSet rows with typed getters, column labels, NULL handling and java.time, closing resources, query timeouts and fetch sizes, and analyzing SQLException chains, SQLStates, subclasses and warnings.
Get a database to practice with, write JDBC URLs for PostgreSQL, MySQL, Oracle, SQL Server, H2 and SQLite, put the driver JAR on the class path, connect with DriverManager or a DataSource, keep credentials out of code, trace JDBC calls and handle login failures.
How JDBC is organized (one API, pluggable vendor drivers, DriverManager and DataSource), the four driver types, where JDBC sits in modern applications, and a refresher of SQL: tables, keys, SELECT, WHERE, LIKE, joins, NULL, grouping, INSERT, UPDATE and DELETE.
How email delivery works from Java: the SMTP conversation (EHLO, MAIL FROM, RCPT TO, DATA), envelopes vs. headers, MIME messages with UTF-8 subjects and Base64 attachments, ports, STARTTLS and authentication, and sending with Jakarta Mail and Angus Mail.
Serve HTTP with the JDK alone: the jwebserver tool, HttpServer contexts and HttpExchange handlers, sending responses correctly, executors and virtual threads, filters, HttpHandlers and SimpleFileServer (Java 18), basic authentication and HttpsServer.