Java Program to Clear the StringBuffer
In this example, we will learn to clear the string buffer using the delete() and setLength() method and creating a new StringBuffer object in Java. Example 1: Java program to…
In this example, we will learn to clear the string buffer using the delete() and setLength() method and creating a new StringBuffer object in Java. Example 1: Java program to…
In this example, we will learn to generate a random string and an alphanumeric random string in Java. Example 1: Java program to generate a random string import java.util.Random; class…
In this example, we will learn to compute all the permutations of the string in Java. Permutation of the string means all the possible new strings that can be formed…
In this example, we will check if two strings are anagram or not in Java. Two strings are said to be anagram if we can form one string by arranging…
In this program, you'll learn different techniques to check if a string is numeric or not in Java. Example 1: Check if a string is numeric public class Numeric {…
In this program, you'll learn to compare two strings in Java. Example 1: Compare two strings public class CompareStrings { public static void main(String[] args) { String style = "Bold";…
In this program, you'll learn to convert a stack trace to a string in Java. Example: Convert stack trace to a string import java.io.PrintWriter; import java.io.StringWriter; public class PrintStackTrace {…
In this program, you'll learn to convert string to date in Java using formatter. Example 1: Convert String to Date using predefined formatters import java.time.LocalDate; import java.time.format.DateTimeFormatter; public class TimeString…
In this example, we will learn to create an immutable class in Java. Java Immutable Class In Java, when we create an object of an immutable class, we cannot change…
In this example, we will learn to create custom checked and unchecked exception in Java. Example 1: Java program to create custom checked exception import java.util.ArrayList; import java.util.Arrays; // create…