Additional Java SE Packages

Practice Programs on JDBC With H2

Program 1: Establishing a Connection with H2 This program establishes a connection between a Java application and an H2 database using JDBC. Program 2: Creating an Employee Table This program creates an employee table in the H2 database using the Statement interface. Program 3: Inserting Records Using PreparedStatement This program inserts an employee record into […]

Practice Programs on JDBC With H2 Read More »

Matches exactly n occurrences of the preceding character or group ({n})

1. Match Exactly 3 Occurrences Using {n} This program demonstrates the {n} quantifier in Java regular expressions. The {n} matches exactly n occurrences of the preceding character or group. Here, {3} matches exactly three consecutive occurrences of the character a. 2. Match Exactly 2 Digits Using {n} This program uses {2} to match exactly two

Matches exactly n occurrences of the preceding character or group ({n}) Read More »

Matches n or more occurrences of the preceding character or group ({n,})

1. Match 3 or More Occurrences Using {n,} This program demonstrates the {n,} quantifier in Java regular expressions. The {n,} matches n or more consecutive occurrences of the preceding character or group. Here, {3,} matches three or more consecutive a characters. 2. Match 2 or More Digits Using {n,} This program uses {2,} to match

Matches n or more occurrences of the preceding character or group ({n,}) Read More »

Matches between n and m occurrences of the preceding character or group ({n,m})

1. Match Between 2 and 4 Occurrences Using {n,m} This program demonstrates the {n,m} quantifier in Java regular expressions. The {n,m} matches at least n and at most m occurrences of the preceding character or group. Here, {2,4} matches between two and four consecutive a characters. 2. Match Between 2 and 3 Digits Using {n,m}

Matches between n and m occurrences of the preceding character or group ({n,m}) Read More »

Practice Programs on Character Classes and Quantifiers

1. Match Digits Using Character Class and Quantifier This program uses the character class \d to match digits. The + quantifier matches one or more consecutive digits. It finds and displays all numbers present in the input. 2. Match Letters Using Character Class and Quantifier This program uses [a-zA-Z] to match English alphabetic characters. The

Practice Programs on Character Classes and Quantifiers Read More »

java.util.Matcher

java.util.regex.Matcher is a class used to perform matching operations on text using a Pattern. It checks whether text matches a regular expression and can also find matching portions of text. Matcher is commonly used for validation, searching, extracting, and replacing text. It works closely with the Pattern class in the java.util.regex package. Important Features: Checks

java.util.Matcher Read More »

FileOutputStream

The FileOutputStream class in Java is used to write raw bytes to a file. It is part of the java.io package and is typically used for binary data (images, audio, etc.) or writing bytes to text files. Commonly Used Constructors and Methods Simple Program Mahesh wants to write the message “Hello LotusJavaPrince!” into a file

FileOutputStream Read More »

Scroll to Top