Skip to content

Tag Archives: Java-Strings

This method is used to strip trailing whitespaces from the string i.e stripTrailing() method removes all the whitespaces only at the ending of the string. … Read More
The string can be repeated N number of times, and we can generate a new string that has repetitions. repeat() method is used to return… Read More
In Java, strings are objects that are backed internally by a char array. So to convert a string to a byte array, we need a… Read More
A LinkedList is a linear data structure, in which the elements are not stored at contiguous memory locations. For converting a linked list to a… Read More
Converting String to ArrayList means each character of the string is added as a separator character element in the ArrayList. Example: Input: 0001 Output: 0… Read More
Given a Set of String, the task is to convert the Set to a comma-separated String in Java. Examples: Input: Set<String> = ["Geeks", "ForGeeks", "GeeksForGeeks"]… Read More
The new operator instantiates a class by dynamically allocating(i.e, allocation at run time) memory for a new object and returning a reference to that memory.… Read More
The regionMatches() method of the String class has two variants that can be used to test if two string regions are matching or equal. There… Read More
Prerequisite:  Strings in Java As we know both Stack and Heap space are part of Java Virtual Machine (JVM). But these memory spaces are used… Read More
Given string str, the task is to write a Java program to swap the pairs of characters of a string. If the string contains an… Read More
Given string str, the task is to write a Java program to swap the first and the last character of the given string and print… Read More
Apache Kafka is a publish-subscribe messaging queue used for real-time streams of data. A messaging queue lets you send messages between processes, applications, and servers.… Read More
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special… Read More
Consider the following two Java programs, the first program produces output as “Yes”, but the second program produces output “No”. Can you guess the reason?… Read More
Prerequisites: String Compact String is one of the performance enhancements introduced in the JVM as part of JDK 9. Till JDK 8, whenever we create… Read More

Start Your Coding Journey Now!