String comparison

There are many ways to do String comparison or equality check in Java 1. By using == operator 2. By using equals() method 3. By using equalsIgnoreCase() method 4. By using compareTo() method By using “==” operator == operator always compares object’s references not the object content. So, whenever we compare 2 strings using == […]

Share this article on

String concatenation

There are several ways to perform string concatenation in Java. 1. Using “+” operator 2. Using String concat() method 3. using StringBuilder and toString() method 4. using StringBuffer and toString() method Let’s discuss each way of doing string concatenation Using “+” operator This is one of the easy ways of doing string concatenation For example, […]

Share this article on
< Previous Next >