Java String concatenation | concat() Method | + Operator

String concatenation means creating a new string by combining the multiple strings. Using the Java string concat() method you can concatenate multiple strings. This is not the only way to do it, but you can also use the “+ ” operator, StringBuilder, StringBuffer, etc. In this tutorial, you will learn how to do Java String concatenation in Read More…


Java substring example | method, indexof, find from end

A SubString is part of any string. Some places programmers need to get, find or fetch a substring in java. Java substring nothing a substring is a subset of another string. To getting a substring in java you can use the inbuilt “Java substring method“. A SubString() method has 2 variants. Single parameter- substring(int beginIndex) double Read More…


String Handling in Java | Substring, concat, Split | Examples

Java String is a very important class. The string is a sequence of characters. Once the String object is created, you can’t change the value of this object. Many ways are we can do String Handling in java. For example find Substring, String concatenation, String compression, Split string, etc. Java String class is encapsulated under java.lang package. It Read More…


Java string split Method | Regex With Space, Comma, Dot Examples

A Java string Split methods have used to get the substring or split or char from String. The split method works on the Regex matched case, if matched then split the string sentences. You can split a string with many time regular expressions, here are some Splitting Regex can be: Space (Whitespace) – (“\\s”) Comma (“,”) Read More…


Java String Class | Syntax | Methods | Examples

The string is a sequence of characters. With Java String class can create a string object. Java String Object is immutable, which means once string objects have created then its values can’t be changed. All string literals (sentence/word etc.) in Java programs, for example “xyz”, are implemented as instances of this class. Syntax Here are ways Read More…


Determine if a string has all Unique Characters

Question : Determine giving string has all Unique Characters. Without Using additional data structures. Solution : Convert String to Char Array  Sort Char Array Compare char[i ] == char[i+1] if true then String not has all uniques characters. import java.util.Arrays; public class Hello { public static void main(String ar[]) { // given String String str = “Rohit”; Read More…


How to reverse string in java example

These are the most common questions asking now a day to Android, Java developers, and technical interviews. There are several different ways to Reverse a string. Here is example for better understanding : Original String : “Hello” Revers String : “olleH” Original String : “My name is rohit” Revers String : “tihor si eman yM” Read More…