In this chapter we will learn Java String, It is used to store a sequence of characters or text.


Example:

String str= "Say Hello";



How to get length of string?

We will use length() method to get the length of the string


Example:

String str= "Hello world!";
System.out.println("The length of the str string is: " + str.length());


output:

run:
The length of the str string is: 12


toUpperCase() method

Convert string letters small to capital


Example:

String str= "Hello World";
System.out.println(str.toUpperCase());   //"HELLO WORLD"




toLowerCase() method

Convert string letters capital to small 


Example

String str= "Hello World";
System.out.println(str.toLowerCase());   //"hello world"



String Concatenation

use + sign to concatenate string


example:

String fname= "Rathor";
String lname= "Ji";
System.out.println(fname+ " " + lname); //output: Rathor Ji



Thanks, May this example help you.