convert string case Example
Strings can simply be converted to upper or lower case. The two methods to perform the conversion are shown here.
Remember they do not change the original string. But when applied to a string they yield a new string.
The value of s therefore remains the same after initialization.
// Convert String Case Example, toUpperCase() and toLowerCase()
class ConvertStringCaseExample {
public static void main(String[] args) {
String s = "Jeff in Venice, Death in Varanasi";
String s1 = s.toUpperCase();
System.out.println(s1);
System.out.println(s.toLowerCase());
System.out.println(s);
}
}
