JDK Tutorials - Herong's Tutorial Examples - v6.32, by Herong Yang
JDK Tutorials - Herong's Tutorial Examples
https://www.herongyang.com/JDK
© 2003-2024 Herong Yang. All rights reserved.
This book is a collection of tutorial notes and sample codes written by the author while he was learning JDK (Java Development Kit) core libraries himself. Topics include Time and Calendar, Internationalization, Unnamed Packages, Collections, Character Set and Encoding, Logging, XML related technologies: DOM, SAX, DTD, XSD, and XSL, Cryptography, Certificates, Key stores, Cipher and Encryption, Socket communication, SSL and HTTPS. Updated in 2024 (Version v6.32) with JDK 20.
Table of Contents
Download and Install JDK 20 on macOS
Download and Install JDK 17 on Windows
Adding JDK "bin" Directory to Path Setting
JDK Documentation Installation
Install JDK with "rpm" Command
Install JDK with "yum" Command
java.time.Instant - Representing a Moment of Time
java.time.Instant Usage Examples
java.time.Instant - get(INSTANT_SECONDS) Error
Converting java.util.Date to java.time.Instant
java.time.ZonedDateTime - Calendar and Timezone
java.time.ZonedDateTime Usage Examples
Converting java.util.GregorianCalendar to java.time.ZonedDateTime
java.time.OffsetDateTime - Calendar and UTC Offset
java.time.OffsetDateTime Usage Examples
java.time.LocalDateTime - Local Date and time without Timezone
Partial Date and Time Objects and Classes
java.time.format.DateTimeFormatter - Date-Time Strings
java.time.Duration - Time Durations
java.time.Duration Usage Examples
java.time.Period - Periods in Days and Months
java.time.Period Usage Examples
Date, Time and Calendar Classes
java.util.Date - JDK Class to Measure Date and Time
java.util.Calendar - The Abstract Calendar Class
java.util.Calendar.add() - Calendar Manipulation Method
Date and Time Object and String Conversion
java.util.DateFormat - Formatting Date Objects to Strings
java.util.SimpleDateFormat.parse() - Parsing Date Strings to Objects
Number Object and Numeric String Conversion
java.util.NumberFormat - Formatting Numeric Values to Strings
java.util.DecimalFormat.parse() - Parsing Strings to Number Objects
Locales, Localization Methods and Resource Bundles
java.util.Locale - Localization and Internationalization
java.util.ResourceBundle - Resource Bundle Abstract Class
java.util.ListResourceBundle - Resource Bundles as Lists
java.util.PropertyResourceBundle - Resource Bundles as Properties Files
java.util.ResourceBundle.getBundle() - Retrieving Resource Bundles
Calling and Importing Classes Defined in Unnamed Packages
One Class in an Unnamed Package - Hello.java
Two Classes in Unnamed Packages - Hello.java and CallingHello.java
Importing Classes Defined in Unnamed Packages
Importing Classes from Unnamed to Named Packages
Importing Classes from Unnamed to Named Packages - JDK 1.4.1
HashSet, Vector, HashMap and Collection Classes
Types of Collections of Elements
Data Structures of Collection Implementations
Collection Implementations in JDK
Search Operation Performance of Different Collection Classes
Comparable Interface and compareTo() Method
Character Set Encoding Classes and Methods
Supported Character Encodings in JDK
Charset.encode() - Method to Encode Characters
Running EncodingSampler.java with CP1252 Encoding
Running EncodingSampler.java with ISO-8859-1 and US-ASCII
Running EncodingSampler.java with UTF-8, UTF-16, UTF16-BE
Running EncodingSampler.java with GB18030
Charset.decode() - Method to Decode Byte Sequences
Character Set Encoding Map Analyzer
Character Set Encoding Maps - US-ASCII and ISO-8859-1/Latin 1
Character Set Encoding Maps - CP1252/Windows-1252
Character Set Encoding Maps - Unicode UTF-8
Character Set Encoding Maps - Unicode UTF-16, UTF-16LE, UTF-16BE
Character Counter Program for Any Given Encoding
Character Set Encoding Comparison
Encoding Conversion Programs for Encoded Text Files
\uxxxx - Entering Unicode Data in Java Programs
HexWriter.java - Converting Encoded Byte Sequences to Hex Values
EncodingConverter.java - Encoding Conversion Sample Program
Viewing Encoded Text Files in Web Browsers
Unicode Signs in Different Encodings
Establishing a Socket Communication Link
ReverseEchoer.java - A Simple Server Socket Application
SocketClient.java - A Simple Client Socket Application
ReverseEchoServer.java - A Multi-Connection Socket Server
Binding Sockets to Specific Ports
Datagram Network Communication
Establishing a Datagram Communication Link
DatagramServer.java - A Datagram Server Application
DatagraClient.java - A Datagram Client Application
DOM (Document Object Model) - API for XML Files
DOMParser.java - Parsing XML Files with DOM
DOMBrowser.java - Browsing DOM Tree Structure
DOMNewDoc.java - Building a New DOM Document
DOMToXML.java - Converting DOM Documents to XML Files
SAX (Simple API for XML) Implementation in JDK
SAXBrowser.java - SAX Based XML Browser
DTD (Document Type Definition) - XML Validation
DOMValidator.java - XML DTD Validation with DOM
SAXValidator.java - XML DTD Validation with SAX
XSD (XML Schema Definition) - XML Validation
XSL (Extensible Stylesheet Language)
XSL (Extensible Stylesheet Language) - Implementation in JDK
XSLTransformer.java - XML Transformer
Message Digest Algorithm Implementations in JDK
java.security.MessageDigest - Message Digest MD5 and SHA
JcaMessageDigest.java - Message Digest Sample Program
Comparing Message Digest Output of MD5 and SHA
Private key and Public Key Pair Generation
Private and Public Keys and Related Interfaces
KeyPair and KeyPairGenerator Classes
Key Pair Sample Program - JcaKeyPair.java
DSA Private Key and Public Key Pair Sample
RSA Private Key and Public Key Pair Sample
DiffieHellman Private Key and Public Key Pair Sample
PKCS#8/X.509 Private/Public Encoding Standards
PKCS#8 and X.509 Key Encoding Classes
java.security.KeyFactory - Reading Encoded Keys
JcaKeyFactoryTest.java - Key Factory Test Program
Reading DSA Private and Public Key Files
Reading RSA Private and Public Key Files
Digital Signature Algorithm and Sample Program
"keytool" Commands and "keystore" Files
Certificates and Certificate Chains
"keytool" - Key and Certificate Management Tool
"keytool -genkeypair" - Generating Keys and Self-Signed Certificates
"keystore" File Type: PKCS12 and JKS
"keytool -export/import" - Exporting and Importing Certificates
"keytool -keyclone" - Cloning Certificates with New Identities
KeyStore and Certificate Classes
java.security.cert.Certificate - The Certificate Class
Using CertificateFactory Class to Read in Certificates
Reading and Writing Certificates in DER and RFC Formats
java.security.KeyStore - The 'keystore' Class
JcaKeyStoreTest.java - 'keystore' Class Test Program
Secret Key Generation and Management
javax.crypto.SecretKey - The Secret Key Interface
javax.crypto.KeyGenerator - Generating Secret Keys
Converting Secret Keys to and from Byte Arrays
JceSecretKeyTest.java - Secret Key Test Program
Cipher - Encryption and Decryption
The SSL (Secure Socket Layer) Protocol
What Is SSL (Secure Socket Layer)?
JSSE - Java Implementation of SSL and TLS
SslSocketTest.java - Default SSL Socket Factory Test
SslContextTest.java - javax.net.ssl.SSLContext Class Test
Initializing SSLContext with PKCS12 File
SSL Socket Communication Testing Programs
HTTPS (Hypertext Transfer Protocol Secure)
HttpsHello.java - HTTPS Server Test Program
HttpsClient.java - HTTPS Client Test Program
HttpsClient.java Failed with JDK 1.8
HTTPS Server with Expired Certificate
Connecting to HttpsHello.java with IE
HttpsEchoer.java - A Better HTTPS Server
Archived: Download and Install JDK 13 on macOS
Archived: Download and Install JDK 12 on Windows
Archived: Downloading and Installing JDK 10
Archived: Downloading and Installing JDK 1.4.1 on Windows
Keywords: Java, JDK, Tutorial, Examples