Java String Class Methods
The java.lang.String class provides a lot of built-in methods that are used to
manipulate string in Java. By the help of these methods, we can perform operations on
String objects such as trimming, concatenating, converting, comparing, replacing strings
etc.
Java String is a powerful concept because everything is treated as a String if you submit
any form in window based, web based or mobile application.
Let's use some important methods of String class.
Java String toUpperCase() and toLowerCase() method
The Java String toUpperCase() method converts this String into uppercase letter and
String toLowerCase() method into lowercase letter.
Stringoperation1.java
1. public class Stringoperation1
2. {
3. public static void main(String ar[])
4. {
5. String s="Sachin";
6. System.out.println(s.toUpperCase());//SACHIN
7. System.out.println(s.toLowerCase());//sachin
8. System.out.println(s);//Sachin(no change in original)
9. }
10. }
Test it Now
Output:
SACHIN
sachin
Sachin