Java String Methods with Examples

Java string methods with examples: There are different string methods in java we will use this methods for perform various operations on the string in java.Following are some Java String Methods with Examples. Program: Get character from a string In this program we use charAt() method to get or access the single character from a specified position. class StringExample { public static void main(String[] args) { String str...

Basic operations on String in Java- Strings Concatenation, Compare

Following programs are for performing the strings basic operations in java like string concatenation, string compare. To perform the string concatenation, string compare in java uses the inbuilt methods in java. String Length: Program: Find the length of string Here we first create the string named str and use the length() method to get the size of the String. class StringExample { public static void main(String[] args) {...

Reverse a String

How to reverse the string? We will use the following different solutions for reversing the string. First we get a input from user using command line. In the first solution of this problem we buffer the input string using the StringBuffer(String string) method. Then reverse this buffer and after reversing convert the buffer into string. Program: public class StringReverse { public static void main(String[] args) { String str...

Back to Top