toLowerCase()
Converts all of the characters in this String to lowercase.
Syntax:
public String toLowerCase()
toUpperCase():
Converts all of the characters in this String to upper case.
Syntax:
public String toUpperCase()
Example:
class TestString{ String str = "Roy"; public void upperCase(){ //will convert all characters in upper case. System.out.println(str.toUpperCase()); } public void lowerCase(){ //will convert all characters in lower case. System.out.println(str.toLowerCase()); } } public class CaseChangeExample { public static void main(String args[]){ //creating TestString object TestString obj = new TestString(); //method call obj.upperCase(); obj.lowerCase(); } }
Output
ROY roy