1/* to find the lowercase or uppercase of a string,
2* we just .toLowerCase() or .toUpperCase()
3*/
4
5public class CaseDemonstration {
6 public static void main(String[] args) {
7
8 String testString = "THIS IS AN EXAMPLE OF A STRING";
9 String testStringLower = testString.toLowerCase(); // make a string lowercase
10 System.out.println(testStringLower); // "this is an example of a string"
11 String testStringUpper = testStringLower.toUpperCase(); // make it upper again
12 System.out.println(testStringUpper); // "THIS IS AN EXAMPLE OF A STRING"
13
14 }
15}
1String s1 = "JAVATPOINT HELLO stRIng";
2String s1lower = s1.toLowerCase(); // s1lower = "javatpoint hello string"
1import java.lang.*;
2
3public class StringDemo {
4 public static void main(String[] args) {
5 // converts all upper case letters in to lower case letters
6 String str1 = "SELF LEARNING CENTER";
7 System.out.println("string value = " + str1.toLowerCase());
8
9 str1 = "TUTORIALS POINT";
10 System.out.println("string value = " + str1.toLowerCase());
11
12 // converts all lower case letters in to upper case letters
13 String str2 = "This is TutorialsPoint";
14
15 System.out.println("string value = " + str2.toUpperCase());
16 str2 = "www.tutorialspoint.com";
17 System.out.println("string value = " + str2.toUpperCase());
18 }
19}